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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -