Help required regarding images in php

Discussion in 'HTML & Website Design' started by nomanz, Jul 5, 2010.

  1. #1
    i am developing a site for used car purchasing. i want to display the images in the home page of the website.. i make 2 tables one for car info and other for images...primary key of car info is id and foriegn key of the image table is id.. i am storing the picture in a folder and saving the name of the picture in the database..
    here is my code plz tell me where is the problem...


    $search = "SELECT *FROM cars_info , front_image Where cars_info.id = front_image.id";
    $result = mysql_query($search,$con) or die(mysql_error());
    $row = mysql_num_rows($result);




    for($i=0;$i<$row;$i++)
    {

    $value = mysql_fetch_array($result);
    {
    echo "<tr>";
    echo "<td bgcolor='#F2F9FF'><div align='center'>";
    echo '<a href="car.php?id='.$value{"id"}.'">';
    echo '<img src="front/'.$value{"name"}.' width="40" height="40"/>';



    //**name is the column name of the image table where i am storing the image name**/


    echo "</a>";
    echo "</div></td>";
    echo "<td bgcolor='#F2F9FF'><div align='center'>";
    echo '<a href="car.php?id='.$value{"id"}.'">';
    echo $value{"Make"};
    echo "</a>";
    echo "</div></td>";
    echo "<td bgcolor='#F2F9FF'><div align='center'>";
    echo '<a href="car.php?id='.$value{"id"}.'">';
    echo $value{"model"};
    echo "</a>";
    echo "</div></td>";
    echo "<td bgcolor='#F2F9FF'><div align='center'>";
    echo '<a href="car.php?id='.$value{"id"}.'">';
    echo $value{"price"};
    echo "</a>";
    echo "</div></td>";/****************/
    echo "</tr>";
    }

    }
    ?>



    thanks in advance..waiting for experts opinion
     
    nomanz, Jul 5, 2010 IP
  2. nomanz

    nomanz Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    only image column is giving problem.. i mean its not picking up the images from the foldel...its only displaying the small hyperlink
     
    nomanz, Jul 5, 2010 IP
  3. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #3
    Rainulf, Jul 5, 2010 IP
  4. nomanz

    nomanz Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    but this syntax is working all the other information except images are displaying correctly
     
    nomanz, Jul 5, 2010 IP
  5. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #5
    Hmm, that's weird way. I personally haven't tried it that way (because arrays are always [] to me)..
    Okay. Replace:
    echo '<img src="front/'.$value{"name"}.' width="40" height="40"/>'; 
    Code (markup):
    with this:
    echo '<img src="front/'.$value{"name"}.'" width="40" height="40"/>'; 
    Code (markup):
     
    Rainulf, Jul 5, 2010 IP
  6. nomanz

    nomanz Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    thanks a lot problem have been solved :)
    one double qaute was missing so thats y it was not displaying :)
     
    nomanz, Jul 5, 2010 IP