By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,454 Members | 3,103 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,454 IT Pros & Developers. It's quick & easy.

Php display product list..image and description

P: 1
Salam, first of all i would like to say hi all.This is my first time posting question over here. Basically im trying to make a simple product list to be display over our web project development subject. Im very new in php.. and learn coding by using modifying existing coding.. i dont really understand PHP coding :P
anyway.. now im having a problem where by.. the description is already out according to their product_id .. but my image only display image with p_id ==1..
i dont know how to edit this code so that the image display all the according p_id.

heres my code

----------------------------------------------
yo.php

<?php
//connect to database
mysql_connect("localhost","root") or die(mysql_error());
mysql_select_db("online") or die(mysql_error());

//file properties


// if (IsSet($_GET['p_id']))
//{
$rsPix = "select p_image,p_des from product";

//$strSQL = "SELECT p_image, p_des FROM product where p_id=".$_GET['p_id'];
$result = mysql_query ($rsPix);

$i = 1;
//$row=mysql_fetch_object($rsPix);
//$insert = mysql_query("INSERT INTO product VALUES('','','','','','','','','','','$image','')" ) or die(mysql_error());
//$i < $numRows
while($row=mysql_fetch_object($result))

{
?>
<br>
<img src="get.php" width="250" height="250"/>

<?php

echo "<br>";
echo "{$row->p_des}<BR>";
$i++;
}

?>









-------------------------------
get.php

<?php
//connect to database
mysql_connect("localhost","root") or die(mysql_error());
mysql_select_db("online") or die(mysql_error());

//$p_id=addslashes($_REQUEST['p_id']);
//IsSet($_GET['p_id']);
$image = mysql_query("SELECT p_image FROM product");
//.$_GET['p_id']);
//$rsPix = @mysql_query("select p_image,p_des from product where p_id = ".$_GET['p_id']);
$image = mysql_fetch_assoc($image);
$image = $image['p_image'];

header("Content-type:image/jpeg");
echo $image;
?>
Apr 2 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.