我被困在这里给我这个错误=(有什么帮助吗?
$link = mysql_connect("localhost","odyssexxxxxx","xxxxxxxx")
or die ("Could not connect :" . mysql_error());
// db
mysql_select_db("odysseus_matchcode",$link);
// ejecucion del query
if ($insert_stmt = $mysqli->prepare("UPDATE members SET (nombre, apellido, username, email, password, salt, telefono) VALUES (?, ?, ?, ?, ?, ?, ?) WHERE `cedula` = '$cedula'",$link)) {
$insert_stmt->bind_param('sssssss', $nombre, $apellido, $username, $email, $password, $random_salt, $telefono);
// Execute the prepared query.
$insert_stmt->execute();
}
Run Code Online (Sandbox Code Playgroud)
您正在混合使用API和样式。
mysql_connect并且mysql_select_db与MySQLi属于不同的库。
尝试拥有:
$mysqli = new mysqli("host","user","password","database");
Run Code Online (Sandbox Code Playgroud)
代替:
$link = mysql_connect("localhost","odyssexxxxxx","xxxxxxxx")
or die ("Could not connect :" . mysql_error());
// db
mysql_select_db("odysseus_matchcode",$link);
Run Code Online (Sandbox Code Playgroud)
然后将准备好的语句更改为:
if ($insert_stmt = $mysqli->prepare("UPDATE members SET (nombre, apellido, username, email, password, salt, telefono) VALUES (?, ?, ?, ?, ?, ?, ?) WHERE `cedula` = ?")) {
$insert_stmt->bind_param('ssssssss', $nombre, $apellido, $username, $email, $password, $random_salt, $telefono,$cedula);
Run Code Online (Sandbox Code Playgroud)
我也建议阅读手册:http : //uk1.php.net/manual/en/book.mysqli.php
开始于:
Mysqli :: Construct来查看如何正确初始化MySQLi类,然后继续执行准备好的语句stmt::FunctionName
| 归档时间: |
|
| 查看次数: |
2883 次 |
| 最近记录: |