Hi, I have some code whicj out puts the data as it should. However I want it to be formatted into a table like this - <table style="text-align: left; width: 600px;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td></td> <td></td> </tr> <tr> <td></td> <td></td> </tr> <tr> <td></td> <td></td> </tr> </tbody> </table> HTML: At the moment its just outputs 1 col going down. here is the php code - <? $sql="select * from members,photos where members.username=photos.username and active=1 and approved='Y' ORDER BY UPLDATE DESC LIMIT 0, 5"; $result = mysql_query($sql); $res=mysql_query($sql); while($obj=mysql_fetch_object($res)) { if($obj->url=="") { $img="<a href='http://www.pictures2rate.com/index.php?&username=$obj->username&phid=$obj->photosid''><img border=0 width=100 height=100 src='../pics/$obj->filename'></a>"; } else { $img="<a target='_blank' href='$obj->url'><img border=0 width=100 height=100 src='$obj->url'></a>"; } $id=$obj->photosid; $username=$obj->username; ?> <table> <tr> <td><? print $img; ?><br /><a href="http://www.pictures2rate.com/index.php?cmd=20&username=<? print $username; ?>">View <? print $username; ?>'s profile</a></td> </tr> </table> <? } if($count!=0) { ?> <? } ?> PHP:
Please don't cross-post. Bump your thread. http://forums.digitalpoint.com/showthread.php?p=5062410#post5062410
And try this <? $sql="select * from members,photos where members.username=photos.username and active=1 and approved='Y' ORDER BY UPLDATE DESC LIMIT 0, 5"; $res=mysql_query($sql) OR die(mysql_error()); $rows = 0; ?> <table> <tr> <?php while($obj=mysql_fetch_object($res)) { echo "<td>\n"; if($obj->url=="") { $img="<a href='http://www.pictures2rate.com/index.php?&username=$obj->username&phid=$obj->photosid''><img border=0 width=100 height=100 src='../pics/$obj->filename'></a>"; } else { $img="<a target='_blank' href='$obj->url'><img border=0 width=100 height=100 src='$obj->url'></a>"; } $id=$obj->photosid; $username=$obj->username; print $img; ?> <br /><a href="http://www.pictures2rate.com/index.php?cmd=20&username=<? print $username; ?>">View <? print $username; ?>'s profile</a> <?php echo "</td>"; if (++$rows % 2 == 0) { echo "</tr>\n<tr>\n"; } } ?> </tr> </table> PHP: