Hi!
I am trying to retrieve different products with their respective attributes from a MySql database table where the different fields are:
product_id
product_name
product_pic (type: TEXT) - Need help here! (See Below)
product_price
product_briefdesc
product_category
product_status
I would like to display all of these values for each product from the table that has a product_category value=8 AND a product_status=2 .
So far, the loop is displaying the value of all of the products just like I wanted it. However, it's not showing the PICTURE which has been uploaded in a separate directory I setup on the server. I guess the question would be: "How do I access the picture filename located in a different directory while processing a loop.
I am new to PHP, so I don't know what's wrong with displaying a picture filename like "product_picture = NoPic.jpg" when its content is in a directory called "images"?
What am I doing wrong?
Thank You LifeSaver - WhoEver You Are!
Here is the LOOP code I am currently using:
PHP Code:
<table>
<?php
// Database Connection is Fine.
// SQL Query (seems to be fine!) as follows:
$productselect= @mysql_query("SELECT product_name,
product_price, product_pic,
product_briefdesc,
product_id FROM Products
WHERE product_category=8
AND product_status=2");
// To begin loop displaying product details:
while ($product = mysql_fetch_array($productselect))
{
$ProductName = $product["product_name"];
$ProductPrice = $product["product_price"];
$ProductPic = ($product["product_pic"]);
$ProductBrief = htmlspecialchars($product["product_briefdesc"]);
$ProductID = $product["product_id"];
// I mostly need help with the PICTURE LINE ONLY!
// Variable "$ProductPic" , Field Name "product_pic"
// Location "images" directory.
// EVERY THING ELSE WORKS!
echo("<tr> ".
"<td width='22%'> ".
"<a href='product.php?pid=". $ProductID .">".
"<img src='images/".$ProductPic."' width=75 border=0>". //Problem is HERE! No Picture or X-Box Displayed.
"</a> ".
"</td>".
"<td width='55%'> ".
"<a href='product.php?pid=". $ProductID ."'>".
" <b>". $ProductName ." </b> ".
"</a>".
" <br>".
"<b> <font size='2' color='darkgreen'>Retail Price: ".
"<s>$". $ProductRetail. "</s>".
"</font> / <font size='2' color='#CC0000'>Our Price:".
" $". $ProductPrice. "</font> </b> ".
"<br>". $ProductBrief ."<br>".
"<a href='product.php?pid=". $ProductID ."'>".
" More Info </a> ".
"</td>".
"</tr>");
}
?>
</table>


Live life to the fullest and have fun in the process!


Bookmarks