Skip to content

Instantly share code, notes, and snippets.

@loraxx753
Created October 4, 2012 16:03
Show Gist options
  • Save loraxx753/3834613 to your computer and use it in GitHub Desktop.
Save loraxx753/3834613 to your computer and use it in GitHub Desktop.
<?php
//Lets say the itema are stored in the $items variable
//$items[0]['Product Image'] is "product1.jpg" (that's what you would put in the database/the picture of the first item)
//Then you'd do
foreach($items as $item)
{ ?>
<h2><?=$item['Product Name']?></h2>
<img src="img/<?php echo $item['Product Image'];?>.jpg" />
<p><?=$item['Description']?></p>
<?php } //This ends the foreach loop
//Which would look like <img src="img/product1.jpg" /><img src="img/product2.jpg" /><img src="img/product3.jpg" /> in the browser.
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment