用PHP3作树型目录(4)
时间:2007-02-17 来源:PHP爱好者
<?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;
}
}
?>
php爱好者站 http://www.phpfans.net php基础|php进阶|php模板.
$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;
}
}
?>
php爱好者站 http://www.phpfans.net php基础|php进阶|php模板.
相关阅读 更多 +