Re: ARGHHH...what's wrong here????
| From: | Matt Schroebel | Date: | Thu, 14 Sep 2000 19:57:10 +0000 |
| Subject: | Re: ARGHHH...what's wrong here???? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16825@lists.php.net to get a copy of this message | ||
You need to change the value of $item_type and $item_count inside the for loop by fetching the next
row. Also, you need to handle the case where you have an odd number of results, otherwise your last
row of the table will be
option(last) option(last)
>>> "Shane McBride" <php@riversidedesigns.net> 09/14 3:34 PM >>>
I am trying to get a table to print with two colums like this:
option1 option2
option3 option4
option5 option6
etc...
currently it's doing this:
option1 option1
option2 option2
etc...
<?
echo "<tr>";
while($row1 = mysql_fetch_array($sql_result1)) {
$item_type = $row1["html_value"];
$sql_count = "SELECT COUNT(item_type) ourcount FROM products WHERE item_type =
\"$item_type\"";
$sql_count_result = mysql_query($sql_count, $connection);
$row1 = mysql_fetch_array($sql_count_result);
$item_count = $row1["ourcount"];
for ($i=0; $i<2; $i++) {
echo "<td><font face=\"Arial, Helvetica, sans-serif\"
size=\"1\"><A HREF='shop_showcat.php?item_type=". urlencode($item_type)
."'>$item_type ($item_count)</a></font></td>";
}
echo "</tr>";
}
mysql_free_result($sql_result1);
?>
Here's the link to see this in action:
http://www.thebackcarecenter.com/RDI_Shop/index.php