shahid_hussnain Posted February 12, 2011 Share Posted February 12, 2011 hi i m new in php, i design a shopping cart. I saved a image file name in mysql and image physical store in filesystem. ....................................... <body> <p> <?php do { ?> <?php echo $row_Recordset1['prod_image']; ?><br /> <?php echo $image_filename = "_images/". $row_Recordset1['prod_image'].".jpg"; ?><br /> <img src="<?php echo trim($image_filename); ?>" alt="image logo" name="image1" width="223" height="73" id="image1" style="background-color: #FFCCCC" /><br /> <br /> <br /> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </p> </body> ..................................... script has no errors, problem is i get filename from database but i run the script, it comes display one image(first record) from filesystem and rest of record image are not display. i tried image or image placeholder. regards Shahid Hussnain Quote Link to comment Share on other sites More sharing options...
acefirefighter Posted February 12, 2011 Share Posted February 12, 2011 I am really not sure what it is your going for but I think I interpreted enough to get you this. <body> <p><?php while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)) { echo $row_Recordset1['prod_image'] . '<br />'; $image_filename = trim("_images/". $row_Recordset1['prod_image'].".jpg"); echo '<img src="'.$image_filename.'" alt="imagelogo" name="image1" width="223" height="73" id="image1" style="background-color: #FFCCCC" />'; echo '<br /><br /><br />'; } </p> </body> Quote Link to comment Share on other sites More sharing options...
shahid_hussnain Posted February 12, 2011 Author Share Posted February 12, 2011 all records are displayed but image item value (pic) are not display...... thanks Quote Link to comment Share on other sites More sharing options...
acefirefighter Posted February 12, 2011 Share Posted February 12, 2011 all records are displayed but image item value (pic) are not display...... thanks It may be because your file path isn't right ex... if your images are stored at http://www.yourSite.com/_images/ and the page you are on is http://www.yourSite.com/california/shopping/ then your script is looking for the images in http://www.yourSite.com/california/shopping/_images/ Im not sure if that is the case but I would bet on it. your going to have to define more of your path to the image. I pull everything through the my base index.php file so I don't usually have to deal with this. Anyone feel free to chime in if I am wrong. Quote Link to comment Share on other sites More sharing options...
shahid_hussnain Posted February 12, 2011 Author Share Posted February 12, 2011 thanks u give me hints its very usefull for me, i mistake ididt copy images in web server. sorry i m oracle developer and making a shopping cart to my cousion! i tried but i will do it. thanks Quote Link to comment Share on other sites More sharing options...
acefirefighter Posted February 12, 2011 Share Posted February 12, 2011 Ok, good luck. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.