新手系列之二:大家来看看这段代码有什么问题????
<?php
include "conn.php";
$content=$_POST["content"];
if ($content!="")
{
$mysql_link=mysql_connect($host,$user,$password);
mysql_select_db($bdb,$mysql_link);
$query="select * from t_games where gamesname='$content'";
mysql_query($query);
echo("<script type='text/javascript'>location.href='searchgamesaction.php';</script>");
mysql_close();
exit;
}
else
{
echo("<script type='text/javascript'> alert('Please input the content!');location.href='index.php';</script>");
}
?>
代码好象总是只执行else部分,原因何在???