$str='select * from sdb_token where token_code=\'13\'';
$res=mysql_query($str);
if(){
return true;
}else{
return false;
}
没有查到结果返回 true
查到返回 false
if条件怎么写

解决方案 »

  1.   

    <?php
    $con = mysql_connect("localhost", "hello", "321");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }$db_selected = mysql_select_db("test_db",$con);$sql = "SELECT * FROM person";
    $result = mysql_query($sql,$con);
    if(mysql_num_rows($result))
    {
      echo '找到';
    }mysql_close($con);
    ?>