Reputation: 29
I am trying to show images in my table which shows through the PHP code, however it gives me an error and I can't figure out where.
echo '<tr><td align="left" valign="top" class="description"> . "<img src='images/" . $product_data["mainImageThumbnail"] . "' alt='Product image' />
<p><a href="main.php?prodid=' . $product["product_id"] . '">' . $product["name"] . '</a>
<br /> $products_data["description"] </p>
<a href="#">Remove</a>
</td> ';
Upvotes: 1
Views: 41
Reputation: 1322
echo '<tr>
<td align="left" valign="top" class="description">
<img src="images/' . $product_data["mainImageThumbnail"] . '" alt="Product image"/>
<p>
<a href="main.php?prodid=' . $product["product_id"] . '">' . $product["name"] . '</a>
<br/>' .
$products_data["description"] . '
</p>
<a href="#">Remove</a>
</td> ';
Upvotes: 1
Reputation: 1364
The problem was the concatenation of PHP with HTML
echo '<tr><td align="left" valign="top" class="description">
<img src="images/' . $product_data["mainImageThumbnail"] . '" alt="Product image" />
<p><a href="main.php?prodid=' . $product["product_id"] . '">' . $product["name"] . '</a>
<br />'. $products_data["description"] .'</p>
<a href="#">Remove</a>
</td> ';
Upvotes: 1