Warning: mysql_query() expects parameter 2 tobe resource, object given i

Warning: mysql_query() expects parameter 2 tobe resource, object given in D:\ApaServ\php\includes\duibifun.php on line 26

 Warning: mysql_fetch_row() expects parameter1 to be resource, null given in D:\ApaServ\php\includes\duibifun.php on line 27

 Warning: mysql_query() expects parameter 2 tobe resource, object given in D:\ApaServ\php\includes\duibifun.php on line 47

 Warning: mysql_fetch_row()expects parameter 1 to be resource, null given inD:\ApaServ\php\includes\duibifun.php on line 48

 

这个错误是因为mysql_connect()函数php已经不支持,所以这个函数要改为:

/* $connect_id=mysql_connect($dbserver,$dbusername,$dbpassword);

 mysql_select_db($databasename); */

   //$res = mysql_query($sql,$connect_id);

 //while($row=Mysql_fetch_row($res) and $kk<=20)该句改为:

if ($result $mysqli->query($query)) {

    
/* fetch object array */
    
while ($row $result->fetch_row()) {}

也可以!

改为:   while($row=Mysqli_fetch_row($result) and$kk<=20)

也可。

 

 

 

$connect_id = mysqli_connect("myhost","myuser","mypassw","mybd") or die("Error " . mysqli_error($link));

  $result= $connect_id->query($sql);

   while($row=Mysqli_fetch_row($result) and$kk<=20)

 

你可能感兴趣的:(Warning: mysql_query() expects parameter 2 tobe resource, object given i)