0

我被困在这里它给了我这个错误=(有什么帮助吗?

$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();
}
4

1 回答 1

5

你正在混合你的 API 和风格。

mysql_connect并且mysql_select_db与 MySQLi 属于不同的库。

尝试拥有:

$mysqli = new mysqli("host","user","password","database"); 

代替:

$link = mysql_connect("localhost","odyssexxxxxx","xxxxxxxx")
or die ("Could not connect :" . mysql_error());

// db
mysql_select_db("odysseus_matchcode",$link);

然后将您准备好的语句更改为:

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); 

我还建议阅读手册:http ://uk1.php.net/manual/en/book.mysqli.php

开始于:

Mysqli::Construct以了解如何正确初始化 MySQLi 类,然后继续准备语句stmt::FunctionName

于 2013-07-31T02:05:58.043 回答