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

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny