$conn=mysql_connect("localhost","207","");
mysql_select_db("test");
$sql="select*from users where name=@#".$name."@#";
$result=mysql_query($sql,$conn);
if(!$result){
mysql_close($conn);
return 0;
}
if($obj=mysql_fetch_oject($result)){
mysql_close($conn);
return 0;
}
}
functionj getuserbyid($id){
$conn=mysql_connect("localhost","207","");
mysql_create_db("test");
$sql="select*from users where id=".$id;
$result=mysql_query($sql,$conn);
if(!$result){
mysql_close($conn);
return 0;
}
if($obj=mysql_fetch_object($result)){
mysql_close($conn);
return $obj;
}
else{
mysql_close($conn);
return 0;
}
}
?>
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/