echo sql 或显示“无项目”
需要显示以下内容:
显示某个fabric的所有项目
如果sql中没有可用的fabric,则显示“无结果”
该代码对于第一点来说功能齐全,但不支持第二点功能。 非常感谢您的帮助。
//echo $sql;
$data = "";
$ii = 0;
$m = 0;
while($myrow = mysql_fetch_array($result)){
$ii++;
$m++;
if ($m == 1) $data = $data."<div class=\"page current\" id=\"gallery\">";
elseif ($ii == 1) $data = $data."<div class=\"page\" id=\"gallery\">";
$data = $data."<a href=\"#\" title=\"".$myrow['name']."\" class=\"show_fabric\" rel=\"".$myrow['id']."\"><img src=\"".$image_directory.$myrow['thumbnail']."\" width=\"100 px\" height=\"100 px\"><div class=\"fb_name\">".$myrow['name']."</div></a>\n";
if ($ii == 10) {
$data = $data."</div>";
$ii = 0;
}
}
if ($ii != 10) {
$data = $data."</div>";
}
if (empty($data)) echo "No result";
else echo $data;
The following needs to be displayed:
Display all items of a certain fabric
If no fabrics are available in the sql display "no result"
The code is fully functional for the first point but does not support the second feature.
Many thanks for helping out.
//echo $sql;
$data = "";
$ii = 0;
$m = 0;
while($myrow = mysql_fetch_array($result)){
$ii++;
$m++;
if ($m == 1) $data = $data."<div class=\"page current\" id=\"gallery\">";
elseif ($ii == 1) $data = $data."<div class=\"page\" id=\"gallery\">";
$data = $data."<a href=\"#\" title=\"".$myrow['name']."\" class=\"show_fabric\" rel=\"".$myrow['id']."\"><img src=\"".$image_directory.$myrow['thumbnail']."\" width=\"100 px\" height=\"100 px\"><div class=\"fb_name\">".$myrow['name']."</div></a>\n";
if ($ii == 10) {
$data = $data."</div>";
$ii = 0;
}
}
if ($ii != 10) {
$data = $data."</div>";
}
if (empty($data)) echo "No result";
else echo $data;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用以下修改后的代码,但它仍然每十次迭代创建一个新的
。请注意,HTML ID 必须是唯一的。
You could use the following modified code, but it still creates a new
<div [...] id="gallery">
every ten iterations. Note that HTML IDs must be unique.