How do I insert this data into the database using mysqli
:
print $data->access_token."<br />";
print $data->username."<br />";
print $data->full_name."<br />";
print $data->id."<br />";
...
$conexao = mysql_connect($localhost, $usuario, $senha) or die();
$select =mysql_select_db($bancodedados) or die();
$query = mysql_query("INSERT INTO 'usuarios' () VALUES()");
I'm trying (according to @ Lost's suggestion):
$mysqli = new mysqli('localhost','root','','instagram');
$sql = 'INSERT INTO instagram (acess_token, username, full_name, id) values(?,?,?,?)';
$stmt = $mysqli->prepare($sql);
$stmt->bind_param("ssss", $data->acess_token, $data->user->username, $data->user->full_name
, $data->user->id );
$stmt->execute();
But I get the following error:
( ! ) Fatal error: Call to a member function bind_param() on a
non-object in C:\wamp\www\instagram\example\success.php on line 30
Call Stack
# Time Memory Function Location 1 0.0020 146880 {main}( ) ..\success.php:0