替换MySql查询

时间:2014-03-19 18:29:34

标签: php mysql

我想用新的声明替换旧的mysql语句。如果以下替换概念是正确的,有谁知道我?

以下陈述

$people = mysql_query("SELECT`id`,`full_name` FROM prople WHERE id > '0'") or die (mysql_error()); 
$result = mysql_num_row($people);

if ( $result > 0 ) { 
list($id, $full_name) = mysql_fetch_row($people);

应替换为:

mysql_select_db($database_xx, $yy);
$query_people = "SELECT`id`,`full_name` FROM prople WHERE id > '0'";
$people  = mysql_query($query_people, $yy) or die (mysql_error());
$row_people  = mysql_fetch_row($people);
$totalRows_people = mysql_num_rows($people );

if ( $totalRows_people > 0 ) { 
list($id,$full_name) = mysql_fetch_row($people);

上述更换是否正确?

0 个答案:

没有答案