0

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

3
Contributors
5
Replies
10
Views
5 Years
Discussion Span
Last Post by aaloo
1

try

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

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

Edited by aaloo: n/a

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

echo "<li class='$class'></li>";
}
echo '</ul>';
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.