php - My select query is not working in ajax -
here code use fetch medicines name database in dropdown list
<?php $selmed = mysql_query("select mnam med"); echo '<select onchange="getqty();" id="pf5" name="recmed">'; while ($row = mysql_fetch_array($selmed)) {echo '<option value="'.$row['mnam'].'">'.$row['mnam'].'</option>';} ?>
now want fetch quantity against specific medicine database use ajax follow
var medn = $('#pf5').val(); $.ajax({ type: "post", url: "getqty.php", data: { mednam: medn }, success: function(data) { $("#val").html(data); } }); }
and here getqty.php file think making mistake in query
<?php include('connection.php'); $recm = $_post['mednam']; $rmq = mysql_query("select mqty med mnam ='$recm'"); echo $rmq; ?>
and area want result on changing value shows "resource id #5"
the following line not echo result data
$rmq = mysql_query("select mqty med mnam ='$recm'"); echo $rmq;
use while loop echo results
$rmq = mysql_query("select mqty med mnam ='$recm'"); while ($row = mysql_fetch_assoc($rmq)) { // echo fields // $row['field_name']; }
Comments
Post a Comment