Jump to content

Display results in multiple colums


mdmogren

Recommended Posts

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>";

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.