php新手。尝试在循环中创建带有文本的图像列表。该脚本仅适用于 ,但我想为其添加一个类名,以便我可以使用 css 控制它,但我收到错误消息。似乎不能与 HTML 一起干净地流动。有什么建议么?
$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();