用PHP3作树型目录(4)
发表于:2007-07-01来源:作者:点击数:
标签:
?function getuserbyname($name){ $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_
<?function getuserbyname($name){
$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;
}
}
?>
原文转自:http://www.ltesting.net