Answer the question
In order to leave comments, you need to log in
How to separate array elements?
Hello, there is such a task:
Get a certain number of id (9 characters each) and compare them one by one with those stored in the database, if there is a match, then change the value in the database. For example, there are several id, 1,2,3, they need to be compared with those in the database. For example, there is a match with id number 2, and then you need to update the line in the database with this id.
To get data from the database I use the following code:
foreach ($likes_get ['response'] ['items'] as $likes) {
$r = $likes['id'];
$q = mysqli_query($db_connect, "SELECT id FROM `users` WHERE `id` = '$r'");
$rows = mysqli_fetch_assoc($q);
if ($rows['id'] == $r) {
$query = mysqli_query($db_connect, "UPDATE `users` SET `likes_count` = '2' WHERE `id` = '$rows['id']'");
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question