Jump to content

Echo Array Data


mainstreetop

Recommended Posts

I posted this previously and did receive some suggestions, but I am still unclear how to achieve what I need.

 

Here is my query...

$sql = 'SELECT item.*, attributes.*
          FROM item
          LEFT JOIN attributes
          ON item.ProductNumber = attributes.ProductNumber
          WHERE item.ProductNumber = 9503731
          ORDER BY attributes.AttributePriority';
$result = mysql_query($sql);
while ($row = mysql_fetch_array($results))  {
   $ProductNumber = $row['ProductNumber'];
   $Image = $row['ItemImage'];
   $AttribPriority =  $row['AttributePriority'];
   $AttribName = $row['AttributeName'];
   $AttribValue =  row['AttributeValue'];
}

 

Below is the information I am having trouble rendering properly. It is my ATTRIBUTES table. Every product in the ITEMS table has the potential for up to 20 attributes where I would like to display both the AttributeName & AttributeValue. I am trying to echo each attrib name & value.

 

This is how the data is stored in the 'attribute' table:

 

ProductNumber AttributePriority    AttributeName                      AttributeValue

9503731                4                      Clerk Totalizers [Nom]          4

9503731                5                      Compartments                      4 Bill Drawer

9503731                5                      Compartments                    5 Coin Drawer

 

It was previously suggested that I set up my code like this:

$getAll_array  = array();
while ($row = mysql_fetch_array($results))  {
   array_push($getAll_array, $row);
}

 

If I print_r($getAll); I see all the data within the array. I'm just not sure how to retrieve the rows individually so I can place the variable in HTML for display.

 

Thanks for any help.

 

 

Link to comment
https://forums.phpfreaks.com/topic/193955-echo-array-data/
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.