由于某种原因,代码没有更新数据库,即使它认为它运行没有错误,任何想法?!它是一个动态包含所以我已经有了包含login_check函数的functions.php以及其他一些函数。
<?php
if(login_check($mysqli) == true) {
// The hashed password from the form
$password1 = $_POST['p'];
// Create a random salt
$random_salt = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true));
// Create salted password (Careful not to over season)
$password1 = hash('sha512', $password1.$random_salt);
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
if($nombre1=="" || $apellido1=="" || $username1=="" || $email1=="" || $password1=="" || $telefono1==""){
$errors=1;
$error.="<li>You did not fill one or more required fields, go back and try again.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email1)){
$error.="<li>Invalid email address.";
$errors=1;
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
// coneccion al servidor de bases de datos
$mysqli = new mysqli("xxx","xxxxx","xxxx","xxxxx") or die ("Could not connect :" . mysql_error());
// ejecucion del query
if ($insert_stmt = $mysqli->prepare("UPDATE members SET (nombre, apellido, username, email, password, salt, telefono) VALUES (?, ?, ?, ?, ?, ?, ?) WHERE `cedula` = '$cedula'")) {
$insert_stmt->bind_param('sssssss', $nombre1, $apellido1, $username1, $email1, $password1, $random_salt, $telefono1);
// Execute the prepared query.
$insert_stmt->execute();
}
?>
//html here
<?
}
}
?>
答案 0 :(得分:0)
如果我是对的
像这样的SQL更新 -update yourTable set nombre=?,apellido=?,username=? where cedula='$cedula';
像这样的SQL插件 -
insert into yourTable(nombre,username,apellido) values(?,?,?);
使用sql sysntax尝试此操作。感谢