Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
stmt_init();

if(!$stmt->prepare($sql)) {
die("SQL error: " . $mysqli->error);
}

$stmt->bind_param("sss",
$_POST["username"],
$_POST["email"],
$password_hash);

$stmt->execute();

echo"Signup successful";

?>

What I have tried:

Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '. VALUES(?, ?, ?)' at line 2 in C:\xampp\htdocs\myPortfolio\signup.php:38 Stack trace: #0 C:\xampp\htdocs\myPortfolio\signup.php(38): mysqli_stmt->prepare('INSERT INTO use...') #1 {main} thrown in C:\xampp\htdocs\myPortfolio\signup.php on line 38
Posted
Updated 11-Aug-22 2:05am
Comments
Richard MacCutchan 11-Aug-22 8:02am    
We need to see the actual SQL that you are generating; we cannot guess what you have written.
Richard Deeming 11-Aug-22 9:51am    
At a guess, based on the "near '. VALUES(?, ?, ?)'" in your error message, you have a stray . character in your SQL.

But without seeing the actual query you're using, that's just a guess.
Richard MacCutchan 11-Aug-22 11:35am    
Well spotted.

1 solution

Without knowing what the SQL statement is, we can;t help you - and we can;t see what $sql contains.

So start with the debugger (PHP: Debugging in PHP - Manual[^]) and find out exactly what the command string is.
Then look closely at that - the error message seems to say that there is a decimal point immediately before the keyword VALUES that shouldn't be there.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900