VsCode Snippet Duplicates Variables

festus_francis_71b3baa851

Festus Francis

Posted on September 11, 2024

VsCode Snippet Duplicates Variables

Hi, here is my login code snippet on VsCode. The snippet works as it should, but the problem is when I change the $$Email variable to username and I hit Tab key, the $Email variable $$_POST['$Email'] gets duplicated to $_POST['username$username']. The same also goes for Pword. How do I remedy this, please?

"Login": {
"prefix": "Login",
"body": [
"include '$connectdb.php';",
"$$Email = $$_POST['$Email'];",
"$$Pword = $$_POST['$Pword'];",
"$$sql = \"SELECT * FROM $staff WHERE Email = '$$Email' AND Pword = '$$Pword'\";",
"$$result = $$conn->query($$sql);",
"if (mysqli_num_rows($$result) == 1) {",
" $$row = mysqli_fetch_assoc($$result);",
" if ($$row['Email'] == $$Email && $$row['Pword'] == $$Pword && $$row['Role'] == '$Student') {",
" header('Location:$profile.php?id='.$$row['id']);",
" } elseif ($$row['Email'] == $$Email && $$row['Pword'] == $$Pword && $$row['Role'] == '$Admin') {",
" header('Location:$Admin.php?id='.$$row['id']);",
" }",
"} else {",
" header('Location:$index.html');",
"}"
],
"description": "Login to db"
}

💖 💪 🙅 🚩
festus_francis_71b3baa851
Festus Francis

Posted on September 11, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related