当我运行此代码时,没有任何显示。
<?php
$host="***********"; // Host name
$username="**********"; // Mysql username
$password="***********"; // Mysql password
$db_name="**********"; // Database name
$tbl_name="members"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$query="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
echo "ID Number: ". $row['id']. "<br />Name: ". $row["name"]. "<br />Project Status: ". $row["status"]. "<br />Day Started: ". $row["start"]. "<br />Estimated Finish Date: ". $row["finish"]. "<br />Main Phone Number: <a href='tel:". $row["mainphone"]. "'>". $row["mainphone"]. "</a>". "<br />Business Phone Number: <a href='tel:". $row["businessphone"]. "'>". $row["businessphone"]. "</a>". "<br />Home Phone Number: <a href='tel:". $row["homephone"]. "'>". $row["homephone"]. "</a>". "<br />Fax: ". $row["fax"]. "<br />Email Address: ". $row["email"]. "<br />Job Estimate: $". $row["estimate"]. "<br />Job Address: ". $row["address"] ;
}
mysql_close();
?>
它出现了一个纯白色的屏幕。在我添加while
之前,除了应该从SQL中获取的数据之外,所有内容都正确显示。如果你能指出它为什么不起作用的任何缺陷或原因,我将不胜感激。