nathanmaxsonadil Posted August 21, 2007 Share Posted August 21, 2007 I have a html table and a database and I want a database to fill in the html table but I have to tr's here's my code $result = mysql_query('SELECT * FROM sites LIMIT 4') or die('Could not connect: ' . mysql_error()); while ($row = mysql_fetch_assoc($result)) { echo "<tr><td width='50%' valign='top'> <div> <a href='{$row['href']}'> <img style='border:0;' src='siteimg/{$row['img']}' alt='{$row['alt']}'/> <br/> {$row['url']} </a> </div> </td></tr>"; this works however it just has 1 tr for the whole list I want to have half in on tr and half in the other Quote Link to comment https://forums.phpfreaks.com/topic/65903-solved-2-trs-in-a-query/ Share on other sites More sharing options...
trq Posted August 21, 2007 Share Posted August 21, 2007 So its not actually your query thats the problem? Take a look here. Quote Link to comment https://forums.phpfreaks.com/topic/65903-solved-2-trs-in-a-query/#findComment-329447 Share on other sites More sharing options...
nathanmaxsonadil Posted August 21, 2007 Author Share Posted August 21, 2007 no Quote Link to comment https://forums.phpfreaks.com/topic/65903-solved-2-trs-in-a-query/#findComment-329448 Share on other sites More sharing options...
sandy1028 Posted August 21, 2007 Share Posted August 21, 2007 try your query like this $result = "SELECT * FROM sites LIMIT 4"; $res=mysql_query($result); Quote Link to comment https://forums.phpfreaks.com/topic/65903-solved-2-trs-in-a-query/#findComment-329568 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.