我创建了一个 .php 文件,当我尝试通过 localhost 执行它时,它什么也没显示。如果脚本工作正常,那么它应该在屏幕上打印一些东西。<- 脚本的基本思想,但没有显示任何内容。
<?php
$con = mysql_connect("localhost","somanshu","somanshu");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("james007", $con);
$result = mysql_query("SELECT * FROM info");
while($row = mysql_fetch_array($result))
{
if($_POST['mail'] == $row['email'])
{
echo "Logged In.<META HTTP-EQUIV=\"refresh\" CONTENT=\"0;URL=home\">";
}
else
{
$sql="INSERT INTO info (email, password)
VALUES
('$_POST[mail]','$_POST[pwd]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
else
{
echo "Added. <META HTTP-EQUIV=\"refresh\" CONTENT=\"0;URL=home\">";
}
}
}
mysql_close($con);
?>