以下是代码片段:
<?php
require_once('db.platform.inc');
$gid=100;
$task='setup';
$status='A';
$sql="select * from checklist where game_id=$gid and task='$task' and status='$status'";
$result=mysql_query($sql);
/*if (!$result) { // add this check.
echo "record doesn't exists";
die('Invalid query: ' . mysql_error());
}
else
{
echo "record exists!!!";
}
*/
$row = mysql_fetch_array($result, MYSQL_ASSOC);
// if (empty($row['game_id']))
if (!mysql_num_rows($result))
{
echo "record doesn't exist~~~~~!!!!!!";
}
else
{
// echo mysql_num_rows($result)."\n";
echo $row['game_id'];
echo $row['task'];
}
?>
转载于:https://blog.51cto.com/brucetam/1001759