Update PHP with javascript trigger and MySQL backend -
i trying create thumbnail carousel on page. loads 6 images links sql database. when click next button go down list of 6 images selecting border current 1 page on. when on image 6 , click next, want load next 6 in descending order mysql database. can't seem this. have setup.
--connect , select database
$con = mysql_connect("localhost", "xxxx", "xxxx"); mysql_select_db("xxxx"); $result = mysql_query("select sql_calc_found_rows * `images` `id` order id desc limit 6"); $row_object = mysql_query("select found_rows() rowcount"); $row_object = mysql_fetch_object($row_object); $actual_row_count = $row_object->rowcount;
and code in carousel working
<div id="thumbs-top" class="jcarousel"> <ul id="thumbs-data" class="thumbs-grid"> <?php while ($row = mysql_fetch_array($result)) { echo '<li><a href="########'.$row['filename'].'.html">'; echo '<img class="thumb-title" src="http://dknwp6sl3x0i8.cloudfront.net/thumbs/'.$row['filename'].'.jpg" title="### ###<p>441 points : 185,038 views</p>" />'; echo '</a></li>'; } ?> </ul>
now have setup if url matches href in unordered list, adds class selected makes border around thumbnail.
too load next 6 thumbnail images database have setup if there no "selected" class in ul load php script post next 6 cannot work
<script type='text/javascript'> $(document).ready(function () { if (!$('ul.thumbs-grid li img').hasclass('thumb-title selected')) { $('#thumbs-data').load('data.php'); } }); </script>
this doesn't seem work. creates mysql fetch array error.
warning: mysql_fetch_array(): supplied argument not valid mysql result resource
i want ul in "data.php" overwrite current data loaded in carousel.
is there other way fix or this? i'm new coding please bear me
site having trouble on - http://vine.youlawl.com/
Comments
Post a Comment