$db = new PDO('sqlite:database.sqlite3');
$account = json_decode(getUserData($userID, $token), true);
$userName = $account['response'][0]['first_name'].' '.$account['response'][0]['last_name'];
$insert = "INSERT INTO accounts (hash, login, password, user_id, avatar_url, name, friends, followers, token) VALUES (:hash, :login, :password, :user_id, :avatar_url, :name, :friends, :followers, :token)";
$statement = $db->prepare($insert);
$statement->bindValue(':hash', md5(uniqid(rand(), true)));
$statement->bindValue(':login', $_POST['email']);
$statement->bindValue(':password', $_POST['pass']);
$statement->bindValue(':user_id', $userID);
$statement->bindValue(':avatar_url', $account['response'][0]['photo_200']);
$statement->bindValue(':name', $userName);
$statement->bindValue(':friends', $account['response'][0]['counters']['friends']);
$statement->bindValue(':followers', $account['response'][0]['counters']['followers']);
$statement->bindValue(':token', $token);
$statement->execute();
}
может так? https://stackoverflow.com/questions/12344741/binding-multiple-values-in-pdo
Обсуждают сегодня