Jump to content

Array Help


cybtec

Recommended Posts

I am attempting to retrieve 3 product element from each record in a database and display them in a table 4 cells across, with each cell holding the 3 elements for each product.

 

I know this needs to use a multidimensional array, I don't know what the correct syntax is for the array and  I can't figure it out.

 

Below is where I'm at with the code, any help figuring out what I need to do would be appreciated.

 

-----------

 

$query = "SELECT productId,productCode,Name FROM inventory ORDER BY productID ASC";

$result = mysql_query($query) or die(mysql_error());

 

echo "<table>";

 

while($row(4,3) = mysql_fetch_row($result))

{

echo "<tr><td>$row[0], $row[1], $row[2]</td><td>$row[3], $row[4], $row[5]<td></td><td>$row[6], $row[7], $row[8]</td><td>$row[9], $row[10], $row[11]</td></tr>\n";

}

echo "</table>";

 

--------------

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/191350-array-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.