Note that there are some explanatory texts on larger screens.

plurals
  1. POQuery from ajax call not working
    text
    copied!<p>Please don't ask why I use <code>mysql_*</code> functions. I just need to use this for now so please don't suggest <code>mysqli_*</code> functions and <code>PDO</code> cause i'm aware of that. <br /> My problem is that my query doesn't return any data. But when I tried to run the <code>sql</code> in my server it worked so I just don't know what I'm missing right now. So please help.<br /> Here is my <code>script</code>:</p> <pre><code> $(document).on('click','#btn-generate-pdf',function(){ var date = $('#service-date').val(), dataString = "date="+ date; $.ajax({ type: "POST", url: "functionko.php?call=retrievedate", data: dataString, success:function(data){ $('#services-container').html(data); } }); }); </code></pre> <p>And here is my <code>functionko.php</code></p> <pre><code> switch($_GET['call']){ case 'test': checkuser(); break; case 'getuser'; getuser(); break; case 'paybill'; paybill(); break; case 'retrievedate'; retrievedate(); //&lt;----- break; default: break; } function retrievedate(){ $date = '2013-12-19'; //$date = $_POST['date']; $sql = "SELECT * FROM rendered_services WHERE rendered_date = '$date'"; $result = mysql_query($sql); $data= array(); print_r($sql); if($result){ while($row = mysql_fetch_assoc($result)){ echo $row['client_name']; } }else{ echo ' &lt;table border="0" width="100%" cellpadding="0" cellspacing="0" class="display" id="attendance" class="jtable" &gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Client Name&lt;/th&gt; &lt;th&gt;Service Name&lt;/th&gt; &lt;th&gt;Date&lt;/th&gt; &lt;th&gt;Therapist&lt;/th&gt; &lt;th&gt;Status&lt;/th&gt; &lt;th&gt;Price&lt;/th&gt; &lt;th&gt;Subtotal&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;/tbody&gt; &lt;/table&gt;'; } </code></pre> <p>So what I'm missing here? TIA!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload