-1

I've tried running a query but it says that I have an error in my SQL syntax. Why?

This should be the only code you need:

$sql = "INSERT (email, username, password) VALUES ($email, $username, $password)";

I am also aware of SQL injection. I will add a patch which is mysqli_real_eacape_string() function.

Qirel
  • 25,449
  • 7
  • 45
  • 62
  • This should be the only answer you need: INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...) – arbogastes May 21 '17 at 16:09
  • 3
    If you were really aware of SQL injection, you would use prepared statements - not escape the input. – Qirel May 21 '17 at 16:12

1 Answers1

1

You are missing the table name. Try

$sql = "INSERT INTO table_name (email, username, password) VALUES ($email, $username, $password)";
Qirel
  • 25,449
  • 7
  • 45
  • 62
Tobias Walter
  • 436
  • 2
  • 7