«

php查询数据库

Genius 发布于 阅读:256 PHP技术


$sql = "SELECT * FROM `site` WHERE id ='1';";
    $result=mysql_query($sql);
    if($result&&mysql_num_rows($result)){
       while ($row=mysql_fetch_assoc($result)) {
             $enit = $row['enit'];
             $version = $row['version'];
             $cdk = $row['cdk'];
             $copyright = $row['copyright'];
       }
    }   
    $sql = "select * from admin where username='$username' and password='$password'";  
   $row=mysql_fetch_array(mysql_query($sql));
   $id = $row['id'];