Php if-else头不重定向

Php if-else头不重定向,php,redirect,Php,Redirect,我试图创建一个重定向,但由于某种原因,它不起作用,就我的生活而言,我不明白为什么。if命令工作正常,但else命令工作不正常。 有什么建议吗 $sql="SELECT * FROM $tbl_name WHERE uid='"; $sql=$sql . $xoopsUser->uid("s") . "' "; // Get a specific result from the "example" table $result = mysql_query($sql) or die(my

我试图创建一个重定向,但由于某种原因,它不起作用,就我的生活而言,我不明白为什么。if命令工作正常,但else命令工作不正常。
有什么建议吗

$sql="SELECT * FROM $tbl_name  WHERE uid='";
$sql=$sql .  $xoopsUser->uid("s") . "'  ";

// Get a specific result from the "example" table
$result = mysql_query($sql) or die(mysql_error());


   if (mysql_num_rows($result) == 0) {
    print "<div class='blockTitle'><strong>DOWNLOADS</strong></div><p><br><p>";
    echo "<div align='center'>You currently have no projects pending payment.<p>If you just completed a     transaction but missed the link on the PayPal page, click <a     href='http://site.co.uk/site/modules/cjaycontent/index.php?id=6'>here</a>.</div>";
}

  else{
 header('Location: http://site.co.uk/site/myComposerList2.php');
}
$sql=“从$tbl_name中选择*其中uid=”;
$sql=$sql$xoopsUser->uid(“s”)。"'  ";
//从“示例”表中获取特定结果
$result=mysql\u query($sql)或die(mysql\u error());
if(mysql_num_rows($result)==0){
打印“下载”
”; echo“您当前没有任何项目等待付款。如果您刚刚完成一项交易,但错过了PayPal页面上的链接,请单击。”; } 否则{ 标题('位置:http://site.co.uk/site/myComposerList2.php'); }
您需要使用
退出
标题
不会阻止脚本立即执行

像这样:

header('Location: http://site.co.uk/site/myComposerList2.php');
exit;

退出
后面<代码>标题()你不工作是什么意思?你犯了什么错误?if-else块后面有代码吗?那么,调用else子句时会发生什么?空白页面,一些错误?我得到了它:退出是我需要的,但它不工作,因为该页面被敲入我的cms站点,代码如下:include(“mainfile.php”);包括(XOOPS_ROOT_PATH.“/header.php”);我把它取下来了,它还能用。感谢JTC。在php.net上,请记住在发送任何实际输出之前必须调用header(),使用include和一些echo或空格是非常常见的