View Single Post
Old 12-13-2012, 01:33 PM   PM User | #5
mharrison
New Coder

 
Join Date: Dec 2012
Posts: 52
Thanks: 12
Thanked 0 Times in 0 Posts
mharrison is an unknown quantity at this point
Quote:
Originally Posted by AndrewGSW View Post
Something like the following although I'm unable to test it currently.

PHP Code:
<?php
$result 
mysql_query("SELECT * from patterns WHERE cattxt = 'Wreaths' ORDER BY dsptxt"); 
$split 0;
echo 
"<table><tr>";
while(
$row mysql_fetch_array($result)) 

    echo 
"<td><a href=\"".$row['lnktxt']."\">".$row['dsptxt']."</a></td>";
    if (
$split++ % 2) {    // or (($split++ % 2) == 1)
        
echo "</tr><tr>";
    } 
}
if (
$split 2) {
    echo 
"</tr></table>";
} else {
    echo 
"<td></td></tr></table>";
}
?>
In particular, I may have the last two echoes the wrong way round(?).

You might end up with a blank row, so it needs a little more work.


This does exactly what I want it to do....add the table width of 100% in there so it spaces the table out through the whole screen and it is perfect! The only oddity is I have 2 links at the very top showing out of alphabetical order, but it may be a problem with how they were entered in the database.
mharrison is offline   Reply With Quote