警告:mysqli::prepare()正好需要1个参数,中给定了2个


Warning: mysqli::prepare() expects exactly 1 parameter, 2 given in

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

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

您正在混合API和样式。

CCD_ 1和CCD_。

尝试拥有:

$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::构造以查看如何正确初始化Mysqli类,然后转到准备好的语句stmt::FunctionName