Porkie Posted August 4, 2009 Share Posted August 4, 2009 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 More sharing options...
abazoskib Posted August 4, 2009 Share Posted August 4, 2009 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>'; } Link to comment https://forums.phpfreaks.com/topic/168814-simple-question-on-rows/#findComment-890669 Share on other sites More sharing options...
Porkie Posted August 4, 2009 Author Share Posted August 4, 2009 still same problem mate, cheers for the reply tho Link to comment https://forums.phpfreaks.com/topic/168814-simple-question-on-rows/#findComment-890675 Share on other sites More sharing options...
abazoskib Posted August 4, 2009 Share Posted August 4, 2009 ahh i see what it is. you need to use mysql_fetch_assoc, not mysql_fetch_array Link to comment https://forums.phpfreaks.com/topic/168814-simple-question-on-rows/#findComment-890677 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.