如何用php检查mysql id行号?

时间:2014-06-20 15:16:39

标签: php mysql

如何用php检查mysql id行号?我的代码不起作用

$id = '$url_id';
$con=mysqli_connect("DBHOST","DBUSER","DBPASS","DBNAME");
$sqlCheckRow = mysql_query( "SELECT * FROM gagzavnili WHERE id=".$url_id." " ) or die ( mysql_error() );
$rowCounted = mysql_num_rows( $sqlCheckRow );
if ( $rowCounted == '50' ) @header("location:error8.php");

1 个答案:

答案 0 :(得分:0)

尝试执行以下SQL语句,应该这样做:

$sqlCheckRow = mysql_query("SELECT * FROM gagzavnili WHERE id=$url_id" ) or die
(mysql_error() );