How to do this display using php and mysql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Homeboy
Forum Newbie
Posts: 6
Joined: Fri Aug 05, 2005 12:23 pm

How to do this display using php and mysql

Post by Homeboy »

Hello,

I want to be able to do something like this on the costco website
http://www.costco.com/Common/Category.a ... |1133|2512

I have pictures that i like to put a price of it on the right side and then have a description of it on the third column.

So basically have 3 columns on a row, 1 column have the picture, 2 column have the the price information and the 3 column have the description of it. How can i achieve this?

Thanks,

Homeboy
pennythetuff
Forum Newbie
Posts: 22
Joined: Sun Feb 19, 2006 6:05 pm
Location: Kokomo, Indiana

Post by pennythetuff »

First off don't store actual pictures in your database. Just store the address to the picture which should be located in an images folder somewhere on your server. Just to let you know in case you are doing this.

Here's a way you could do it.


Code: Select all

$query = "...";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);

for($a = 0; $a < count($row); a++) {
     echo "<img src=\"" . $row['picture_row'] . "\" />";
     echo "Price Information: " . $row['price_information'];
     echo "Description: " . $row['descrip'];
}
Of course you could replace the echo's with variables, and the $row index's with your actual column names in your database. Have you worked with PHP and MySQL before? The example above is assuming you have. If you haven't then check out the PHP documentation on PHP's site (http://www.php.net). Here's a link to their MySQL functions. http://us3.php.net/manual/en/ref.mysql.php.
Post Reply