php - The value is not inserting in database -


i want create api registration otp verification. otp sent on mobile. value of users not inserted in database. here signup code. please me stuck in this. in advanced.

signup.php

<?php  include('config.php');  if( !empty($_post['name']) &&      !empty($_post['mobile']) &&      !empty($_post['email']) &&      !empty($_post['password'])   ){      $name = $_post['name'];     $mobile = $_post['mobile'];     $email = $_post['email'];     $password = $_post['password'];     $str = mt_rand(100000, 999999);       $avalible_user_name="";     $avalible_user_email="";      $sql= mysql_query("select *  users mobile='".$mobile."' ");     while($row=mysql_fetch_array($sql)){         $avalible_user_name=$row['mobile'];     }     $sql= mysql_query("select *  users email='".$email."' ");     while($row=mysql_fetch_array($sql)){         $avalible_user_email=$row['email'];     }            if($avalible_user_name=="" && $avalible_user_email==""){                                     $sqlquery = mysql_query("insert users set                                              name = '" . $name."',                                             mobile = '" . $mobile."',                                             email = '" . $email."',                                             password = '" . md5($password)."',                                             otp = '".$str."',                                             status = 0 ");                        $msg = "your verification code:".$str.".";                     $sms_text = str_replace(" ","%20",$msg);                     $api_key = '2584909553545c';                     $from = 'chkotp';                     $api_url = "**my otp url**";                     $response = file_get_contents($api_url);                      die(json_encode(array("success"=>"true","message"=>"otp sent mobile number please verify.")));                                   }else{              die(json_encode(array("success"=>"false","message"=>"mobile or email ready exits ")));         } }else{          die(json_encode(array("success"=>"false","message"=>"empty parameters..!!"))); } ?> 

your insert query syntax wrong,

$new_pass = md5($password); $sqlquery = mysql_query("insert users( name, mobile, email, password) values('$name','$mobile','$email','$new_pass')"); 

i hope helps.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -