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

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!

no that shows on the webpage

bmw x5images/bmw x5

can anyone still help?

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>";

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

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

Thank you very much i will post as solved

Glad to help :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.