<?php
/*
* Created on 2010-3-3
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
$mysqli=mysqli_connect("localhost","root","x-d","news");
$sql = "SELECT * FROM news";
$res = mysqli_query($mysqli,$sql);$a = mysql_fetch_array($res);
$num = mysql_num_rows($a);echo $num;?>报下面的错 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in G:\PHP\news\select.php on line 14 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in G:\PHP\news\select.php on line 15 请大侠指导
/*
* Created on 2010-3-3
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
$mysqli=mysqli_connect("localhost","root","x-d","news");
$sql = "SELECT * FROM news";
$res = mysqli_query($mysqli,$sql);$a = mysql_fetch_array($res);
$num = mysql_num_rows($a);echo $num;?>报下面的错 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in G:\PHP\news\select.php on line 14 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in G:\PHP\news\select.php on line 15 请大侠指导
mixed mysqli_query ( mysqli $link , string $query [, int $resultmode ] )
$num = mysql_num_rows($a);---------------------------把上面的mysql_ 换成mysqli_
<?php
/*
* Created on 2010-3-3
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
$mysqli=mysqli_connect("localhost","root","x-d","news");
$sql = "SELECT * FROM news";
$res = mysqli_query($mysqli,$sql);$a = mysqli_fetch_array($res);
$num = mysqli_num_rows($res);echo $num;
print_r($a);
?>