【发布时间】:2016-12-28 07:35:08
【问题描述】:
我正在做一个项目,我必须验证用户的手机号码。我已经生成了 otp 并将其成功交付给移动用户。但是 otp 变量在更新 mysql 查询中没有显示任何值。在 echo 上打印结果。
代码在这里:
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);
}
输出画面:
1E2ewz7
update clients set mobile='4422336699', address='new way', city='fkldsjl', country='IN', opt_code='' where id = '131'
【问题讨论】: