新手系列之六:请大家帮我看下这个if语句哪里出了问题???
<?
//省略连接语句
$name=$_POST["g_name"];
if($name!=="")
{
$str="select * from t_goods where name='$name' and f_check='1'";
$result=mysql_query($str);
$row=mysql_fetch_row($result);
if ($row[0]!='')
{
$query= "insert into t_games(Category,gamesname,Content,Features) values('$category','$name','$content','$feature')";
mysql_query($query);
echo("<script type='text/javascript'> alert('添加成功!');location.href='addgames.php';</script>");
mysql_close();
exit;
}
else
{
echo ("<script type='text/javascript'> alert('名称有重复,添加失败!');history.go(-1);</script>");
}
}
else
{
echo ("<script type='text/javascript'> alert('填写资料不完整!');history.go(-1);</script>");
}
?>
运行没问题,但条件判断没起作用,输任意名称都可以添加成功,错在哪呢??请指点