谢谢你,我是这样写的 <?php $query="SELECT * from zhengshu where xm='$name' and zsbh='$number' and csrq='$time' and xb='$sex'"; $mydb->query($query); $mydb->next_record(); //等待帮助的地方 $name2=$mydb->f(xm);if($name2=''){ echo"<script>top.location.href='xxxx.php';</script>"; } ?> 数据库没有记录,怎么还是没有跳转呢?
<?php
$query="SELECT * from zhengshu where xm='$name' and zsbh='$number' and csrq='$time' and xb='$sex'";
$mydb->query($query);
$mydb->next_record();
//等待帮助的地方
$name2=$mydb->f(xm);if($name2=''){
echo"<script>top.location.href='xxxx.php';</script>";
}
?>
数据库没有记录,怎么还是没有跳转呢?
if($name2=''){
echo "is NULL";
//echo"<script>top.location.href='xxxx.php';</script>";
}
else {
echo "isn't NULL";
}
echo '<meta http-equiv="refresh" content="0;URL=xx.htm">';
echo '<meta http-equiv="refresh" content="0;URL=xx.htm">';
header("location:xxxxx.php");//但要保证在执行此程序之前,没有任何信息输入浏览器
语法错误 写也应该是if($name2=='')
用这个吧: if(empty($name2))
function login($username,$password){
global $dbhost,$dbuser,$dbpasswd,$dbname,$down_user_table,$cookie_name;$sql = "SELECT * FROM $down_user_table WHERE username='$username'";
$result = mysql_db_query($dbname, $sql);
$objresult = mysql_fetch_object($result);
$user_password = $objresult->password;if ($username=="" || $password==""):
echo "用户名或密码不能为空";
echo "<br><a href=javascript:history.back(1)>点击这里返回</a>";
exit;
endif;if ($user_password == ""):
echo "用户名错误";
echo "<br><a href=javascript:history.back(1)>点击这里返回</a>";
exit;
endif;if ($password != $user_password):
echo "密码错误";
echo "<br><a href=javascript:history.back(1)>点击这里返回</a>";
exit;
endif;setcookie ($cookie_name."[1]",$username,time()+(1*24*3600));
setcookie ($cookie_name."[2]",$password,time()+(1*24*3600));echo "登录成功!";
//echo "<META HTTP-EQUIV=REFRESH CONTENT='0;URL=list.php'>";exit;} // end login
header("location:yoururl");
or
<Script lauguage=javascript>window.location.href=url</script>