Okay, here's what I'm trying to do:
I've got a datafeed, and I would like to display it with X number of items PER row. I've got a script that will put one item per row, and I can mod that to make it one item per column, but neither of those produce a clean output. Can one of you php gurus help a guy out?
Here is the basic feed:
So the output is just one long page of items. I changed the query to limit the results to 12. Ideally this should output a table with 3 colums and 4 rows.
I figure I need to define that somewhere, and then increment the rows so I added these variables:
Then I get stumped...
I've got a datafeed, and I would like to display it with X number of items PER row. I've got a script that will put one item per row, and I can mod that to make it one item per column, but neither of those produce a clean output. Can one of you php gurus help a guy out?
Here is the basic feed:
PHP:
<?php
$login = "netshops";
$password = "feedme";
$table = "clockstyle";
$aid = "cd1";
$database = "netshopsaffiliates_com_-_datafeeds";
$connection = mysql_connect("207.234.208.224","$login","$password")
or die ("Unable to connect.");
mysql_select_db($database)
or die ("Unable to open database.");
$sql = "SELECT * FROM $table order by category limit 0,12";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
{
extract($row);
echo "<table width='100%' border='0' cellspacing='0' cellpadding='3'> \n";
echo "<tr>\n";
echo "<td valign='top'>\n<a href='$link$aid'> <img src='$image' border=0> </a> \n <br> <b> Price: </b> $$price\n </td> \n";
echo "<td valign='top'>\n<a href='$link$aid'> \n<b> $product </b> </a> \n<br> $description\n <br> <b> Item: </b> <i> $sku </i> \n <b> Category: </b> <i> $category </i> <br> </td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<hr size='1'>\n";
}
mysql_close($connection);
?>
I figure I need to define that somewhere, and then increment the rows so I added these variables:
PHP:
$row_items = 4;
$total_items = 12;
$total_rows = round(($total_items / $row_items), 0);
$current_row = 0;
Then I get stumped...