954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Parse error: syntax error, unexpected T_ECHO

this is a part of my code and i m getting this error somewhere in this part
Parse error: syntax error, unexpected T_ECHO

$data = mysql_query("SELECT * FROM $title") or die(mysql_error()); 
while($info = mysql_fetch_array( $data )) 
{ 
?>
 
<div id="username"><? php echo $info['name'] ?></div>
<div id="statement"> <? php echo $info['comment'] ?></div>
<hr/>
<?php } ?>


please somebody help me , i could not solve this !!!!!!

aaloo
Junior Poster in Training
76 posts since Oct 2011
Reputation Points: 22
Solved Threads: 0
 

try

<div id="username"><?php echo $info['name']; ?></div>
<div id="statement"> <?php echo $info['comment']; ?></div>
diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

Thanks sir ! i really did a silly mistake

i have a one more question if you could answer me

i am making a list in html and i want to give different styles to alternate elements in the list.how it is possible ??

aaloo
Junior Poster in Training
76 posts since Oct 2011
Reputation Points: 22
Solved Threads: 0
 
$class = 'otherRow';
echo '<ul>';
while($info = mysql_fetch_array( $data )) {
    
if ($class == 'otherRow')
    $class = '';
else
    $class = 'otherRow';

echo "<li class='$class'></li>";
}
echo '</ul>';
qazplm114477
Junior Poster
193 posts since Apr 2010
Reputation Points: 24
Solved Threads: 37
 
diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

Thanks again , you all are genius !!

aaloo
Junior Poster in Training
76 posts since Oct 2011
Reputation Points: 22
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: