Jump to content

simple question on rows


Porkie

Recommended Posts

i dont seems to be able to get my data to go into rows instead of columns i know its simple but where am i going wrong?

 

Cheers in advance

 

mysql_select_db("", $con);

$q = "SELECT *  WHERE type = 'Music Enthusiast' ORDER BY name ASC";
$sql2 = mysql_query($q);

echo '<table><tr>';
echo '<td>';
echo 'Music Enthusiasts';
echo '</td>';
echo '</tr>';
while ($row = mysql_fetch_array($sql2)) {
     echo '<tr>';
 echo '<td>';
 echo $row['name'];
 echo '</td>';
     echo '</tr>';
 echo '<tr>';
         echo '<td>';
 echo '<img style="width:80px;height:80px;" src="img/avatar/'.$row['avatar'].'.jpg" />';
     
}
echo '</td></tr></table>';

Link to comment
https://forums.phpfreaks.com/topic/168814-simple-question-on-rows/
Share on other sites

try this:

 

while ($row = mysql_fetch_array($sql2)) {
     echo '<tr>';
    echo '<td>';
    echo $row['name'];
    echo '</td>';
     echo '</tr>';
    echo '<tr>';
         echo '<td>';
    echo '<img style="width:80px;height:80px;" src="img/avatar/'.$row['avatar'].'.jpg" />';
echo '</tr>';
     
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.