T_ELSE error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
syareez
Forum Newbie
Posts: 3
Joined: Fri Sep 16, 2011 7:41 am

T_ELSE error

Post 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>';
	
}
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: T_ELSE error

Post 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.
syareez
Forum Newbie
Posts: 3
Joined: Fri Sep 16, 2011 7:41 am

Re: T_ELSE error

Post 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:
Post Reply