Date Posted:17-02-2017

This post we will explain on how to avoid duplicate mobile number update in user profile.

Assumption:

Table Name: ls_user

Column name:phone, email

Implementation:

First,pass your email id and also pass new phone number

second,run the query and check the number of rows zero mean execute next functionality otherwise return value.

<?php
$query=mysql_query("SELECT `phone`FROM `ls_users` WHERE `email` NOT IN('example@gmail.com') AND `phone` = '1234567890'");
if(mysql_num_rows($query)>0)
{
  echo "Not Possible to add this number try with another number"
}
else
{
 mysql_query("update ls_users set phone='12346543'" where email='example@gmail.com'");
}

Leave a Reply