开发者

PHP MYSQL : why i am getting this warning?

When I use

mysql_affected_rows($result);

...in php then I get below warning how to remove it?

Warning: mysql_affected_rows(): supplied resource is 开发者_StackOverflow社区not a valid MySQL-Link resource in C:\wamp\www\st_db_1\search_db.php on line 60


I assume $result = mysql_query() ??

Don't pass it that variable, you can pass it the connection link $variable or just use mysql_affected_rows();


if($result)
{
    mysql_affected_rows($result);

}


$result must be the link identifier not the query example

$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');

// will return for the most recent connection
echo mysql_affected_rows();

// will return for $link connection defined 2 rows up
echo mysql_affected_rows($link);


Your query did not produce a valid result.
Try echo mysql_error() before calling mysql_affected_rows().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜