php - JQuery colorbox 不适用于 PHP/MySQL

标签 php jquery mysql colorbox

我有非常基本的彩盒脚本:

<script src="data/scripts/jquery-1.10.2.min.js"></script>
<script src="/data/scripts/jquery.colorbox.js"></script>

<script>
$(document).ready(function(){  
    $(".InternalIMG").colorbox({rel:'InternalIMG', transition:"fade"})
});
</script>

静态文档中的一切都有效。

代码示例:

<a class="InternalIMG" href="/data/images/gallery/testing/UK.png" title="Absolutní schéma">
    <div class="image_left" style="background-image: url('data/images/gallery/testing/UK.png');"></div>
</a>

但是当我在 PHP 变量中使用它时,它根本不起作用:

      $gal_query = mysql_query("SELECT * FROM gomi_galerie_fotky WHERE section=" . $_GET['id'], $link);
      if (mysql_num_rows($gal_query) != 0) {
          while($gal_result=mysql_fetch_assoc($gal_query)) {
              if ($gallery_count % 3 == 0) {$gallery_rows .= '</tr><tr valign="middle" align="center">';};

              $gallery_rows .= '<td width="150px" height="150px" align="center" valign="middle" style="overflow: hidden;"><a class="InternalIMG" href="/data/images/gallery/testing/UK.png" title="Absolutní schéma"><div class="image_left" style="background-image: url(/data/images/gallery/thumbs/' . $gal_result['id'] . '.' . $gal_result['type'] . ');" title="' . $gal_result['body'] . '"></div></a></td>';
              $gallery_count++;  
          }

          $gallery = '<table align="center" border="0" width="150px" height="150px" style="table-layout:fixed"><tr valign="middle" align="center">' . $gallery_rows . '</tr></table>';

也许 php 文件有问题(这些 php 变量位于另一个 [included] php 文件中)。

感谢您的帮助。

最佳答案

您应该关闭 if 的大括号。在 php 代码末尾添加 }

关于php - JQuery colorbox 不适用于 PHP/MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18172348/

相关文章:

php - 如何将 Controller 索引函数的参数传递给模型的函数?拉维

javascript - 从用户在 HTML 和 Javascript 中输入的数字开始倒计时

jquery - 数据表使用 rowcallback 更改行颜色

javascript - 未捕获的 TypeError Accordion 不是 jQuery 中的函数?

MySQLDump 无法将数据导入亚马逊 RDS

php - 如何在cakephp中以逗号值分隔搜索

mysql - 与同一实体mysql的一对一和一对多关系

php - HTML、PHP 和 CSS 中的 .NET 类型菜单

java - java和php中的时间戳有什么区别?

php - 返回负值