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
only image column is giving problem.. i mean its not picking up the images from the foldel...its only displaying the small hyperlink
You need to check your syntax for arrays, see: http://php.net/manual/en/language.types.array.php $value["price"] Code (markup): is the right syntax, not: $value{"price"} Code (markup):
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):