Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2009

    Red face Unanswered: Not able to retrieve images from database

    I have created a mysql database from which i need to call images in the front end.
    database description:-

    databsae:-my sql
    dbname:-dw_bookstore table:-images, field:- type{varchar} size{30}
    field name:image and stored path is(C:\wamp\www\images\Bluehills.jpg after that i'll try ..\images\Bluehills.jpg ) but its not working.

    PHP code:

    $con = mysql_connect("localhost","root","");
    if (!$con)
    die('Could not connect: ' . mysql_error());

    mysql_select_db("dw_bookstore", $con);

    $result = mysql_query("SELECT * FROM images");

    <img src="<?php echo $row['image']; ?> " alt="<?php echo $row['image']; ?>" />

    and error is:
    some time look blank image or with
    <br /> <b>Notice</b>: Undefined variable: row in <b>C:\wamp\www\view.php</b> on line <b>17</b><br />

    plz help me....................... i am too confused.

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    where did you set the value of the variable $row?

    i'd expect to see something similar to:-
    PHP Code:
    $result = mysql_query("SELECT * FROM images");
    if (Mysql_ErrorNo() != 0)
    { //insert any error handling here
    } else //we found an image

    <img src="<?php echo $row['image']; ?> " alt="<?php echo $row['image']; ?>" />
    I'd rather be riding on the Tiger 800 or the Norton

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts