Using datepicker after a PHP query

Using datepicker after a PHP query

Hello everybody,


I'm trying to deploy jQuery DatePicker in my system, but I had some doubts.


I have a database with various events (with a date),
and I'm trying to make the calendar let it marked all the dates that these events have, for the user and click on the date to see the events of their day. But I have ideas how to do this ... someone help me?

I dont know how to deploy a PHP query inside a jquery script (when the user click on some date, search in the database, and returns a div with the results)...

I'm using this: http://docs.jquery.com/UI/Datepicker

My PHP Query: (It generates someone like this: select eveId, eveTitulo, eveData from eventos where eveData = '2010-01-30'...
  1. <script type="text/javascript">
        $(function(){
            $(".calendario").datepicker({
                onSelect: function(dateText){
                    alert(dateText);
                }
            });
        });
    </script>








  2. <?php
  3.     $query = new Query();
        $query->setTabela(array("eventos"));
        $query->setCampo(array("eveId","eveTitulo","eveData"));
        $query->setCondicao(array("eveData = '2010-01-30'"));
        $resultado = $query->select();
        if($resultado){
            foreach($resultado as $evento){
                $data = retornaData("%d/%m/%y",$evento['eveData']);
            }
        }








  4. ?>
  5. <h1>Datepicker</h1>
  6. <div class="calendario"></div>
    <h2>Day events</h2>
    <div id="divResultado"></div>