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 !!!!!!

Member Avatar for diafol

try

<div id="username"><?php echo $info['name']; ?></div>
<div id="statement"> <?php echo $info['comment']; ?></div>

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 ??

$class = 'otherRow';
echo '<ul>';
while($info = mysql_fetch_array( $data )) {
    
if ($class == 'otherRow')
    $class = '';
else
    $class = 'otherRow';

echo "<li class='$class'></li>";
}
echo '</ul>';

Thanks again , you all are genius !!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.