简体   繁体   中英

JQuery colorbox doesn't work with PHP/MySQL

I have really basic colorbox script:

<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>

Everything works in static document.

Example of code:

<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>

But when I use it in PHP variable, it simply doesn't work:

      $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>';

Maybe is problem with php file (these php variables are in another [included] php file).

Thank for your help.

You should close the brace of if . Add a } to end of php code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM