Jump to content

Help displaying an array


playaz

Recommended Posts

Hi guys,

I am trying to get my array to display two items on each table row so its effectively two <td> tags. The effect I want is similar to how the "Technology partner" section looks on the the following site.

[a href=\"http://tinyurl.com/lemxb\" target=\"_blank\"]http://tinyurl.com/lemxb[/a]

If the array has more than two items it would need to make a new row <tr> - so each table row has 2 items and no more.

Can anyone help me out :)

Link to comment
Share on other sites

No time to explain... but this is what i use to create the same effect.
"" if (($x%2 "" is the bit that does the business... if you wanted to increase your table columns to 3, 4, 5 or whatever... just replace the 2 with the number of columns you need.

Hope this helps you find a way to what you want to do.


[code]
<?php
$bareQuery = "SELECT * FROM My_Table";
$queryall = $bareQuery.$sorted;
$resultall = MYSQL_QUERY($queryall);
$numberall = mysql_Numrows($resultall);

if ($numberall==0) {
    echo "No Slackers Found !";
}
else if ($numberall>0) {
$x=0;
?>
<table class="content" align="center">
<?
while ($x<$numberall)
      {
           if (($x%2)==0) { $row="</tr><tr><td>"; } else { $row="<td>"; }
            
echo $row
?>

[/code]
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.