Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.