I am working on a project where I have to verifiy the user's mobile number. I has generated the otp and its successfully deliver to users mobile. But the otp variable does not show any value in the update mysql query. while on echo it print the result.
Code is here:
if(isset($_POST['mobile']))
{
include_once("connectionfile.php");
$string = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$string_shuffled = str_shuffle($string);
$otpCode = substr($string_shuffled, 1, 7);
echo '<br/>'. $otpCode;
file_get_contents("http://www.sms99.com/ComposeSMS.aspx?username=sample&password=sample&sender=sample&to=$payMob&message=$password&priority=1&dnd=1&unicode=0");
echo '</br>'.$otpCode;
$optQry = "update clients set mobile='$payMob', address='$payAddress', city='$payCity', country='$payCountry', opt_code='$optCode' where id = '$payClient'" ;
echo $optQry;
$qryRes = mysqli_query($con, $optQry)or die("query Error");
print_r($optRes);
}
output screen:
1E2ewz7
update clients set mobile='4422336699', address='new way', city='fkldsjl', country='IN', opt_code='' where id = '131'