Ich erstelle eine Profilseite bearbeiten, wo der angemeldete Benutzer das Profil bearbeiten kann. Ich komme jetzt auf den Fehler unten. was mache ich?Datenbankverbindung fehlgeschlagen Sie haben einen Fehler in Ihrer SQL-Syntax.
ERROR:
Database Connection FailedYou have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '= '[email protected]', Password = 'test', FirstName = 'hello', SecondName = 'world' at line 1
Mein Code:
<?php
$connection = mysqli_connect('localhost', 'root', '', 'dbrateme');
if (!$connection){
die("Database Connection Failed" . mysql_error());
header('Location: dcf.php');
}
$select_db = mysqli_select_db($connection, 'dbrateme');
if (!$select_db){
die("Database Selection Failed" . mysqli_error());
}
if (isset($_POST['upd'])){
$course = $_POST['Course'];
$email = $_POST['inputEmail'];
$password = $_POST['inputPassword'];
$FN = $_POST['FirstName'];
$SN = $_POST['SecondName'];
$qsql = $_COOKIE['userID'];
$qresult = mysqli_query($connection, $qsql);
$qcount = mysqli_connect($qresult);
$sqli = "UPDATE tblaccounts Email = '".$email."', Password = '".$password."', FirstName = '".$FN."', SecondName = '".$SN."', Course = '".$course."' WHERE Student_ID='".$qsql."'";
$result = mysqli_query($connection, $sqli) or die("Database Connection Failed" . mysqli_error($connection));
//$count = mysqli_num_rows($result);
echo "Profile Update Successful!:";
header('Location: profile.php');
} else {
echo "Profile Update Failed!:";
?><br/><a href ="updatesettigns.php">Go back to the profile update screen.</a><?php
}
?>
Weitere Informationen zu vorbereiteten Anweisungen zum Verhindern der SQL-Injektion – Jens
Dies ist eine Tippfehlerfrage; Du hast 'SET' verpasst. –