Jump to content

help me plz!


shahid_hussnain

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/227422-help-me-plz/
Share on other sites

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>

 

Link to comment
https://forums.phpfreaks.com/topic/227422-help-me-plz/#findComment-1173074
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/227422-help-me-plz/#findComment-1173090
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.