mdmogren Posted April 13, 2011 Share Posted April 13, 2011 I am pulling some info from a mysql table, checking some logic, and displaying in on a page. The way this is written now it shows all of the items in a one column table, I simply want to break it up into multiple columns (ideally by specifying say 20 items per column). I know I need a counter and a loop but I'm just not sure how it all fits in with my existing program. Any help would be greatly appreciated. Here is my code $result2 = mysql_query("SELECT * FROM propertyids ORDER BY propertyname ASC"); while($row2 = mysql_fetch_array($result2)){ ${'resp'.$row2['id']} = curl_multi_getcontent(${'ch'.$row2['id']}); ${'status'.$row2['id']} = strpos(${'resp'.$row2['id']},$httpvar); if(${'status'.$row2['id']} === false) { echo "<tr><td>"; echo "<img src='images/down.png'> <a href='" . $row2['primaryurl'] . "' target='_blank'>" . $row2['propertyname'] . "</a>"; echo "</td></tr>"; } else { echo "<tr><td>"; echo "<img src='images/up.png'> <a href='" . $row2['primaryurl'] . "' target='_blank'>" . $row2['propertyname'] . "</a>"; echo "</td></tr>"; } } echo "</td></table>"; Quote Link to comment https://forums.phpfreaks.com/topic/233645-display-results-in-multiple-colums/ Share on other sites More sharing options...
Pikachu2000 Posted April 13, 2011 Share Posted April 13, 2011 Take a look at this thread: http://www.phpfreaks.com/forums/index.php?topic=95426.0 Quote Link to comment https://forums.phpfreaks.com/topic/233645-display-results-in-multiple-colums/#findComment-1201303 Share on other sites More sharing options...
mdmogren Posted April 13, 2011 Author Share Posted April 13, 2011 This mostly makes sense to me but I'm still not sure where to put in which pieces of code, if someone could do the work for me or explain in a little more detail it would be greatly appreciated. Not trying to be lazy but I've been messing with this for hours and I know someone who knows what they're doing can probably type it up in 3 mins. Quote Link to comment https://forums.phpfreaks.com/topic/233645-display-results-in-multiple-colums/#findComment-1201308 Share on other sites More sharing options...
mdmogren Posted April 13, 2011 Author Share Posted April 13, 2011 Update: Just needed to walk away and clear my head, ran an errand and came back and this was easy Not quite what I expected, it goes: 1 2 3 4 5 6 7 8 9 When I was more going for: 1 4 7 2 5 8 3 6 9 But it works Thanks Quote Link to comment https://forums.phpfreaks.com/topic/233645-display-results-in-multiple-colums/#findComment-1201332 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.