我无法从数据库中检索数据(php)

时间:2016-02-18 14:46:32

标签: php

II无法从数据库中检索数据。它不会显示错误但无法检索数据。我试着检查数据库,但我不确定它与它有关?       

//check for a form submissiom
if(isset($_GET['username']) && !empty($_GET['username']))
 {
    $username = $_GET['username'];
mysql_connect("localhost","root","") or die("could not connect to the server");
mysql_select_db("users") or die("the database could not be found! ");
$userquery = mysql_query("SELECT * FROM users WHERE username=$username") or die("the query could not be complete please try again later");

if (mysql_num_rows($userquery) !=1){

    die("that username could not be found");
}
while ($row = mysql_fetch_array($userquery,MYSQL_ASSOC)){
    $Firstname = $row['Firstname'];
    $Lastname = $row['Lastname'];
    $email = $row['email'];
    $username = $row['username'];

    }
    if ($username !=$dbusername){
        die ("there has been a fatal error.Please try again");


    }
  }
 ?>

0 个答案:

没有答案