2010-09-17 62 views
0

下面的代碼導致我正在處理的頁面返回空白頁面。頁面上還有其他代碼可以返回內容,如果我註釋掉下面的代碼,就會出現這樣的代碼。下面的代碼中是否有錯誤?導致內容頁面內容消失的代碼

由於提前,

約翰

$querysub = mysql_query("SELECT subcheck FROM submission WHERE submissionid = $submissionid"); 
$result = mysql_query($querysub); 
if (!$result) { 
    die 'Could not run query: ' . mysql_error(); 
} 
else{ 
$subcheck = mysql_result($result, 0); 
} 

if($uid = $submittor) 
{ 

if($subcheck = 1) 
{ 

echo '<div class="commentnotify">You submitted item story and you have chosen to receive emails when someone comments on it.<a href="http://www...com/.../comments/commentnotifystop.php?submission='.urlencode($row["title"]).'&submissionid='.$row["submissionid"].'&url='.$row["url"].'&countcomments='.strtoupper($row["countComments"]).'&submittor='.$row["username"].'&submissiondate='.$row["datesubmitted"].'&dispurl='.$row["displayurl"].'">Click here to stop.</a></div>'; 


} else { 
    echo '<div class="commentnotify">You submitted this item and you have chosen not to receive emails when someone comments on it.<a href="http://www...com/.../comments/commentnotifystart.php?submission='.urlencode($row["title"]).'&submissionid='.$row["submissionid"].'&url='.$row["url"].'&countcomments='.strtoupper($row["countComments"]).'&submittor='.$row["username"].'&submissiondate='.$row["datesubmitted"].'&dispurl='.$row["displayurl"].'">Click here to start.</a></div>'; 


} else { 

} 

回答

1

您指定賦值運算符=if情況下,需要comparison operator==)代替:

if($uid = $submittor) 

應該是:

if($uid == $submittor) 

而且

if($subcheck == 1) 

你還缺少這行後閉架}

echo '<div class="commentnotify">You submitted this item and you have chosen not to receive emails when someone comments on it.<a href="http://www...com/.../comments/commentnotifystart.php?submission='.urlencode($row["title"]).'&submissionid='.$row["submissionid"].'&url='.$row["url"].'&countcomments='.strtoupper($row["countComments"]).'&submittor='.$row["username"].'&submissiondate='.$row["datesubmitted"].'&dispurl='.$row["displayurl"].'">Click here to start.</a></div>'; 
0

你不能有兩個else塊。但我想這只是在這種情況下,嵌套了一個問題:

if($uid = $submittor) 
{ 
    if($subcheck = 1) 
    { 
     echo '<div class="commentnotify">You submitted item story and you have chosen to receive emails when someone comments on it.<a href="http://www...com/.../comments/commentnotifystop.php?submission='.urlencode($row["title"]).'&submissionid='.$row["submissionid"].'&url='.$row["url"].'&countcomments='.strtoupper($row["countComments"]).'&submittor='.$row["username"].'&submissiondate='.$row["datesubmitted"].'&dispurl='.$row["displayurl"].'">Click here to stop.</a></div>'; 
    } else { 
     echo '<div class="commentnotify">You submitted this item and you have chosen not to receive emails when someone comments on it.<a href="http://www...com/.../comments/commentnotifystart.php?submission='.urlencode($row["title"]).'&submissionid='.$row["submissionid"].'&url='.$row["url"].'&countcomments='.strtoupper($row["countComments"]).'&submittor='.$row["username"].'&submissiondate='.$row["datesubmitted"].'&dispurl='.$row["displayurl"].'">Click here to start.</a></div>'; 

    } // <-- added this one 
} else { 

} 

順便說一句:您正在使用assignment operator=,而不是像comparison operator==。並且賦值運算符產生分配的值。所以表達式$uid = $submittor返回值$submittor$subcheck = 1返回1

0

它缺少if($ uid = $ submittor){...}的最後一個括號。然後你得到一個錯誤,但你的服務器似乎無法顯示它們,顯示一個空白頁面。