Right, I've (somehow) coded a pretty nifty affiliates system for my site -
http://wafflesweb.co.uk/?module=resources&action=affiliates
Basically it allows the user to enter their website address, and the link to their banner, and its added to a database. These then get passed through some code, and are echoed back to the same page, as you can probably see if you visit that page.
However, I want it to echo them out in to rows and columns..ideally
5 affliates , then go down to the next row.
I'm sure this is possible.
Here is my code for showing the affiliate banners.
any suggestions?
Much obliged.
http://wafflesweb.co.uk/?module=resources&action=affiliates
Basically it allows the user to enter their website address, and the link to their banner, and its added to a database. These then get passed through some code, and are echoed back to the same page, as you can probably see if you visit that page.
However, I want it to echo them out in to rows and columns..ideally
5 affliates , then go down to the next row.
I'm sure this is possible.
Here is my code for showing the affiliate banners.
PHP:
<?php
$query="SELECT * from affiliates ";
$result=mysql_query($query) or die ("Could not execute query: $q.". mysql_error());
while($row=mysql_fetch_array($result)) //gets all results in table
{
extract($row); // extract the row and values
// leave php, html for formatting banners - this is the code that needs tweaking i think.
?>
<table width="88" height="31" border="0" cellpadding="0" cellspacing="2">
<tr>
<td align="center">
<?php echo "<a href=\"$url\" target=\"_blank\"><img src=\"$banner\" width=\"88\" height=\"31\" border=\"0\">";?></td> //echos the $banner into the table, and assigns the matching $url to it so when its clicked, it goes to their website.
</tr>
</table>
<?php //back in to php to end the while..
}
?>
any suggestions?
Much obliged.