Ich bin Fehler vonmysqli_query(): Leere Abfrage
mysqli_query(): Empty query in if(mysqli_query($link, $result)){
Catchable fatal error: Object of class mysqli_result could not be converted to string in line echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
bekommen Darf ich wissen, was das Problem hier ist?
<?php
$link = mysqli_connect("localhost", "root", "", "databasename") or die("could not connect to mysql");
$email = $_SESSION['USEREMAIL'];
$password = $_SESSION['USERPASS'];
$sql= mysqli_query($link, "SELECT * FROM admin WHERE email='$email' and password ='$password' ");
if (isset($_POST["submit"])) {
$test = mysqli_real_escape_string($link, $_POST['test']);
$result = mysqli_query($link,"UPDATE admin SET test='$test' WHERE email='$email'");
if(mysqli_query($link, $result)){
echo "Updated successfully.";
} else {
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
}
while ($record = mysqli_fetch_array($sql)) {
$test = $record['test'];
}
mysqli_close($link);
?>
http://php.net/manual/en/mysqli.query.php –
'$ result' ist * bereits ein' mysqli_query() 'Sie müssen' if (mysqli_query ($ link, $ Ergebnis ändern)) {'zu etwas wie' if ($ result)) {' –
** Speichere niemals Klartext-Passwörter! ** Bitte benutze PHP [eingebaute Funktionen] (http://jayblanchard.net/proper_password_hashing_with_PHP.html) um Passwort-Sicherheit handhaben. Wenn Sie eine PHP-Version kleiner als 5.5 verwenden, können Sie das 'password_hash()' [compatibility pack] (https://github.com/ircmaxell/password_compat) verwenden. Stellen Sie sicher, dass Sie *** [Kennwörter nicht entgehen] (http://Stackoverflow.com/q/36628418/1011527) *** oder verwenden Sie einen anderen Bereinigungsmechanismus vor dem Hashing. Wenn Sie dies tun, * ändert * das Passwort und verursacht unnötige zusätzliche Codierung. –