ajax - select query not working php -


i make ajax page php script , computations on result obtained there , return values.

<form id="couponform"> apply coupon: <input type="text" name="addcode" placeholder="apply coupon"> <input class="button"  style="margin-left:10px;" type="submit" value="apply"> </form> <script>      $('#couponform').on('submit',function(e){     e.preventdefault();     var formdata=$(this).serialize();       var totalprice=<?php if(isset($total))echo $total;else echo'"'.'"';?>;      formdata=formdata+'&totalprice='+totalprice;      $.ajax({             url:'/cart/couponajax.php',             type:'post',             datatype:'json',             data:formdata,             success: function (content) {               //something             }      });     }) </script> 

the above page calls php script looks

     require 'config.php';// contains db credentials      $totalprice=$_post['totalprice'];      $couponname=mysqli_real_escape_string($mysqli,$_post['addcode']);      $state=$mysqli->prepare('select * `coupons` `name`=?');      $state->bind_param('s',$couponname);      $state->execute();      $result=$state->get_result();      // $result returns null. 

when check value obtained in $result , shows me this

enter image description here

db looks this

enter image description here enter image description here

i stuck in thing hours , doing wrong here ?

update:

enter image description here


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -