Load MySQL Data using JQuery


Of course, you won't be redirected to another page to see the result. That's the best thing about JQuery, although AJAX can also do it.

Anyway, here's the code snippet for the user's side..

<input id="datepicker" maxlength="20" type="text" />
<div id="refresh_img">Select Date to Load images..</div>

<script type="text/javascript">
$(document).ready(function(){
    $('#datepicker').change(function(){
    var variable= document.getElementById('datepicker').value;
    $('#refresh_img').load('query/getprojimg.php',{"variable": variable}).fadeIn("slow");
 });
});
</script>

And for the server side.


 <?php  
   //error_reporting(0);
   include('../../include/config.php');
   
   $uploaddate=$_POST['variable'];
   $fix=fix_date("$uploaddate");
   
   $query="SELECT * FROM projimg,proj where proj.projid=projimg.projid and uploaddate='$fix' order by imgid DESC;" ;
   $result=mysql_query($query);
....
....
....
?>

Something like that...

Popular posts from this blog

Why I choose her?

Are you an Introvert?

I Am Getting Married!