Hi all!
Need a bit of help again!
I’m currently getting some data out of my database, which just prints out in a list down the page.
How can I get the data to print out across (vertically, rather than streight down the page), and then start a new line after, say, 4 entries are printed?
Here’s my PHP:
<?php
$host="localhost"; // Host name
$username="xxxx"; // Mysql username
$password="xxxx"; // Mysql password
$db_name="xxxx"; // Database name
$tbl_name="xxxx"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name ORDER BY `xxxx`.`id` DESC LIMIT 0 , 10";
$result=mysql_query($sql);
?>
<?php
while($rows=mysql_fetch_array($result)){
?> </td>
</tr>
<tr>
<td bgcolor="#F1F1F1"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="29%"><span class="BodyText"><img src="<? echo $rows['IMAGEURL']; ?>" border="0" /></span></td>
<td width="1%"> </td>
<td width="70%" class="BodyTextTitle"><? echo $rows['TITLE']; ?><br /><br />
<span class="BodyText"><? echo $rows['STORY']; ?><a href="viewstory.php?id=<? echo $rows['id']; ?>"><br /><br /><img src="images/button_viewcontent.gif" border="0" /></a></span></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td class="BodyTextTitle"> </td>
</tr>
</table></td><?php
}
?>
</tr>
<tr>
<td bgcolor="#F1F1F1"><?php
mysql_close();
?>
Any help is much appreciated