There are no errors, but the addition does not happen for some reason. Just writes that "id does not exist." Can someone tell me how to fix it?
if (isset($userInfo['response'][0]['id'])) { $userInfo = $userInfo['response'][0]; $result = mysqli_query($mysqli, "SELECT * FROM users WHERE id = ". $userInfo['id'] .""); $cols = mysqli_num_rows($result); if($cols == 0) { echo 'id не существует'; mysqli_query($mysqli, "INSERT INTO users ('id', 'first_name', 'last_name', 'photo_50') VALUES ({$userInfo['id']}, {$userInfo['first_name']}, {$userInfo['last_name']}, {$userInfo['photo_50']})"); } else { echo 'id существует'; } } All necessary data is coming, the array is not empty.
array(4) { ["id"]=> int(122238003) ["first_name"]=> string(12) "Родион" ["last_name"]=> string(14) "Поляков" ["photo_50"]=> string(54) "http://cs628825.vk.me/v628825003/3f340/jHKzi1BNezk.jpg" } 
$result = mysqli_query($mysqli, "INSERT INTO users ('id', 'first_name', 'last_name', 'photo_50') VALUES ({$userInfo['id']}, {$userInfo['first_name']}, {$userInfo['last_name']}, {$userInfo['photo_50']})"); var_dump($result);what does? - Naumovvar_dump(mysqli_errno($mysqli));exit;- Daniel-664