0

I have this code part of a bigger table with different field names being echoed.

echo "<tr><td>";
	echo $row['car'];
	echo "</td><td>";
	echo $row['caravan'];
	echo "</td><td>";

I need 2 pieces of help please.
I want to add an image of that car, the image is in a folder on the server and the image is named the same as the details in the details in the field that are being echoed. eg in the car field and being echoed is BMW X5 and the image will be images/BMW X5.jpg

I need to add the image in the same row with a break <br /> to ensure there is a space inbetween the field details and the image


Hope somebody can help

Thanks in advance

3
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by MooGeek
0

uhhh, are you trying to echo a string with other string??

like this

echo "<tr><td>";
	echo "images/" . $row['car'];
	echo "</td><td>";
	echo "images/" . $row['caravan'];
	echo "</td><td>";

Cheers!

0

no that shows on the webpage

bmw x5images/bmw x5

can anyone still help?

0
echo "<tr><td>";
echo $row['car'];
echo "</td><td>";
echo $row['caravan'];
echo "</td><td>";
echo "<img src='images/" . $row['car'] . ".jpg' />";
echo "</td></tr>";

Edited by pritaeas: n/a

0

thanks but this shows a blank image as the image url shows images/.jpg , so it is not echoing the database field into the image url.

Can you help please

0

sorry my fault a typo in the car i put cart.

Thank you very much i will post as solved

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.