I have two tables. In each table there is a field 'phone', which contains a telephone number, but the problem is that the table And the phone written in the form "+79876543210", and table B in the form of "+7 (987) 654-32-10".
I need to take a number from the table and check for matches in table B.
What are the options?
I was considering either convert to request view And room B.
Or if possible some simple way to 5500+ rooms in the table B to mean the numbers from table A.
Actually a question - how to convert to query the number of species And number of the form B?
Or how to walk on table B and convert all the numbers?
casandra_Lebsack answered on March 23rd 20 at 18:52
In short, Maxim, I saved you and the nobility will not play: perform for me a couple of features - and we're even. At the same time see how quickly your brain after learning php will become clear. But on your topic I already found out. Fuck knows why you got them so the data store surrendered, but I'm in other people's Affairs do not climb. Want to keep - then you have something...
In the previous question you said that you are getting the json from Yandex.telephony, apparently you're still struggling with it. Yandex transmits data in the format "+79876543210", and in response to Mr @sv09 you mentioned that you get phones with a form on the website, and apparently with the help of the placeholder in the form "+7 (987) 654-32-10".
And now you're trying for some reason to compare the data of Yandex and on your website.
In short, if all that you do in the file that you have writes the data into a database from forms on the website, the following:
$phone = preg_replace("/[^+0-9]/s", "", strip_tags(trim($_POST['phone'])));
Where $phone is, accordingly, a variable that receives the data from the field "phone" in the form.
So you get in your database phone view +79876543210. And then compare them all you want,
This is the easiest option :)
If you need to go through the database and modify all of phones, then make a separate question.
dereck_Ryan94 answered on March 23rd 20 at 18:54
Need from the string remove all characters except numbers and compare the cleaned rooms.
Through replace, but you can in the regular season.