[SOLVED] how to generate records in a horizontal fashion
Posted: Thu Jul 01, 2004 12:37 am
hi,
im trying to generate info from a database and it should list the items in a horizontal fashion with 3 records per row ...so it would look like this:
field1 field1 field1
field2 field2 field2
field1 field1
field2 field2
.... and so on..
so far i have it generating 1 row...but it does return to the second row ..the site can be found at http://www.financialshopper.com/categor ... y_test.php
and here is my code so far:
any help would be appreciated
im trying to generate info from a database and it should list the items in a horizontal fashion with 3 records per row ...so it would look like this:
field1 field1 field1
field2 field2 field2
field1 field1
field2 field2
.... and so on..
so far i have it generating 1 row...but it does return to the second row ..the site can be found at http://www.financialshopper.com/categor ... y_test.php
and here is my code so far:
Code: Select all
$query_cat_d = "SELECT c_name, c_image from category";
$result_cat_d = mysql_query($query_cat_d);
echo ("<TR>");
for ($j = 0; $j < mysql_num_rows($result_cat_d); $j++) {
$rowarray = mysql_fetch_row($result_cat_d);
$field_num = mysql_num_fields($result_cat_d);
//for ($j = 0; $j < $field_num; $j++) {
$remainder = mysql_num_rows($result_cat_d) % 3
echo ("<TD>");
echo ("<TABLE border=1>");
echo ("<TR><TD>") . $rowarray[1] . ("</TD></TR>");
echo ("<TR><TD>") . $rowarray[0] . ("</TD></TR>");
echo ("</TABLE>");
echo ("</TD>");
//}
}
echo ("</TR>");