here is the code which i use to fetch all medicines name from database in dropdown list
<?php
$selmed = mysql_query("SELECT mnam FROM med");
echo '<select onChange="getQty();" id="pf5" name="recmed">';
while ($row = mysql_fetch_array($selmed))
{echo '<option value="'.$row['mnam'].'">'.$row['mnam'].'</option>';}
?>
Now I want to fetch quantity against a specific medicine from database for that i use ajax as follow
var medn = $('#pf5').val();
$.ajax({
type: "POST",
url: "getqty.php",
data: {
mednam: medn
},
success: function(data) {
$("#val").html(data);
}
});
}
and here is my getqty.php file where i think i am making some mistake in query
<?php
include('connection.php');
$recm = $_POST['mednam'];
$rmq = mysql_query("SELECT mqty FROM med WHERE mnam ='$recm'");
echo $rmq;
?>
and the area where i want result on changing value shows "Resource id #5"