Page 1 of 1

T_ELSE error

Posted: Fri Sep 16, 2011 7:46 am
by syareez
I'm so puzzled about this code... :?:

Code: Select all

$sql_blabs = mysql_query("SELECT id, mem_id, the_blab, blab_date, blab_type, device FROM blabbing WHERE mem_id='$id' ORDER BY blab_date DESC LIMIT 30");

while($row = mysql_fetch_array($sql_blabs)){
	
	$blabid = $row["id"];
	
$sql_comments= mysql_query("SELECT * FROM blab_comments WHERE blab_id='$blabid'ORDER BY id ASC");
$count_comment = mysql_num_rows($sql_comments);
if($count_comment > 0){
while($row2 = mysql_fetch_array($sql_comments)){

    $comment_mem_id=$row2['mem_id'];
	$sql_comment_user = mysql_query("SELECT username FROM myMembers WHERE id='$comment_mem_id'LIMIT 1");
    while($row3 = mysql_fetch_array($sql_comment_user)){$comment_user = $row3['username'];}
	
	$comment_txt = $row2['the_comment'];
	$comment_date = $row2['comment_date'];
	$convertedTime = ($myObject -> convert_datetime($comment_date));
    $whenComment = ($myObject -> makeAgo($convertedTime));
	
    if(isset($_SESSION['id'])){
	$BoxComment ='
	<div style="background-color:#f0f9fe";border-bottom:1px dashed #3A69B6; padding:5px; width:auto;">
	<strong>Log In or Sign Up!</strong></div>';
	
    }

}else{
    $BoxComment ='<textarea id="Comment'.$blabid.'"></textarea>';

}
	
 $DisplayCommentList .= '
	<div style="background-color:#f0f9fe";border-bottom:1px dashed #3A69B6; padding:5px; width:auto;">
	<strong>'.$comment_user.'</strong><br/>'.$comment_txt.' <br/> ·'.$whenComment.'·</div> ';


 
}
}else{
$DisplayCommentList ="";
} 
	$blabber_id = $row["mem_id"];
	$the_blab = $row["the_blab"];
	$the_blab = ($activeLinkObject -> makeActiveLink($the_blab));
	$blab_date = $row["blab_date"];
	$convertedTime = ($myObject -> convert_datetime($blab_date));
    $whenBlab = ($myObject -> makeAgo($convertedTime));
	$blab_date = $row["blab_date"];
	$blab_type = $row["blab_type"];
	$blab_device = $row["device"];
    
	 
				$blabberDisplayList .= '
			        <table width="100%" style="background-color:#CCCCCC; border:#999 1px solid; border-top:none;" cellpadding="4" ">
					<tr>
					<td width="7%" rowspan="2" valign="top" bgcolor=##f0f9fe">' . $blab_pic . '</td>
					<td width="93%" bgcolor="#F9F9F9" valign="top" style="line-height:1.5em;">
					<span class="liteGreyColor textsize9"> ' . $whenBlab . ' <a href="profile.php?id=' . $blabber_id . '"><strong>' . $mainNameLine . '</strong></a> via <em>' . $blab_device . '</em></span><br />
					 <span>' . $the_blab . '</span>
					 
            </td>
            </tr>
			<tr>
			<td style="line-height:1.5em;" valign="top">
			'.$DisplayCommentList.'
			<div id="new_comment '.$blabid.'" style="display:none;">
			
			'.$BoxComment.'
			</div>
			
			
			<br/>
			<input type="submit" value="Send Comment" onclick="javascript:SendComment(\''.$blabid.'\');" />
			
			</td>
			</tr>
			</table>';
	
}

Re: T_ELSE error

Posted: Fri Sep 16, 2011 8:20 am
by Celauran
Your nesting is pretty messed up. You've got something that looks like this:

Code: Select all

while
    if
        while
            while
            if
        else
else
Keeping your code properly indented would have allowed you to spot that right away.

Re: T_ELSE error

Posted: Fri Sep 16, 2011 8:32 am
by syareez
Celauran wrote:Your nesting is pretty messed up. You've got something that looks like this:

Code: Select all

while
    if
        while
            while
            if
        else
else
Keeping your code properly indented would have allowed you to spot that right away.
Yeah man...its nasting....
i'm trying many times to solve it
like putting this } close syntax
....and much more....

So how I can solve this nastycode :banghead: