Home  >  Article  >  php教程  >  用PHP3作树型目录(4)

用PHP3作树型目录(4)

WBOY
WBOYOriginal
2016-06-21 09:13:191228browse

  $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;
     }
   }

?>



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn