New to php. Trying to create a list of images with text in a loop. The script works fine with just , but I want to add a class name to it so that I can control it with css, but I am getting an error. Seems not to flow cleanly with HTML. Any suggestions?
$rs = $conn->Execute("SELECT ProductName, ProductID FROM Products ");
//opens a recordset from the connection object
while (!$rs->EOF) {
$fv1=$rs->Fields("ProductID");
$fv2=$rs->Fields("ProductName");
print "<div class="product-img"> ";
print "<a href='moredetails.php?productid=$fv1'>";
print "<img src = \"thumbs/artifact-$fv1.jpg\" alt = \"Artifact-$fv1\"</a><br>";
print "<a href='moredetails.php?productid=$fv1'>";
print "$fv2</a><br>";
print "</div>";
$rs->MoveNext();
}
$rs->Close();
The double quotation will close the php function, try to use a single quotation for your class attr.
or escape it