可能是一个菜鸟问题,但是人们可以通过询问来学习。
我正在尝试设置一个表来加载和显示数据库中的数据。除了最后一栏,我已经完成了所有工作。我希望最后一列是一个显示“查看图像”的链接,当你点击它时,它会打开一个fancybox JS。
这是我的源代码:
<script>
$(document).ready(function() {
$(".fancybox-thumb").fancybox({
prevEffect : 'none',
nextEffect : 'none',
helpers : {
title : {
type: 'outside'
},
thumbs : {
width : 50,
height : 50
}
}
});
});
</script>
<?php
mysql_select_db("premiumguns") or die(mysql_error());
echo "<table id='myTable' class='info' width='100%' border='0' cellspacing='0' cellpadding='0'>";
echo "<thead><tr> <th>Serial</th> <th>Make</th> <th>Model</th> <th>Gauge</th> <th>Barrel</th> <th>Details</th></tr></thead><tbody>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td height=\"20px\">";
echo $row['Serial_No'];
echo "</td><td>";
echo $row['Make'];
echo "</td><td>";
echo $row['Model'];
echo "</td><td>";
echo $row['Gauge'];
echo "</td><td>";
echo $row['Barrel_Length'];
echo "</td><td>";
echo "<a class = "fancybox-thumb" rel="gallery1" href="wp-content/prem_pics/C16719B/C16719B-01.jpg">View Pictures</a>"
echo "</td></tr>";
}
echo "</tbody></table>";
?>
</body>
任何帮助将不胜感激
答案 0 :(得分:3)
您需要在此行周围使用单引号
<?php
echo '<a class = "fancybox-thumb" rel="gallery1" href="wp-content/prem_pics/C16719B/C16719B-01.jpg">View Pictures</a>';
?>