The function below will be used to input a Facebook access token into a database. The user id will already have an associated record so the "acc_tok" field just needs to be updated.
For some reason even though the $_result value holds "1" and the function echoes out "Successful!", a warning is appearing that says:
"Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given". Does anyone know why it appears that the query was successful but is only returning a boolean and not something the mysql_fetch_array can work with? Thanks for reading
function setUserAccessToken($_uid, $_accTok){
$sql = "UPDATE `user_core` SET `acc_tok`=$_accTok WHERE `id` = $_uid";
$_result = mysql_query($sql) or die($sql."<br/><br/>".mysql_error());
echo $_result;
if ($_result) {
echo ("Successful!");
$_resultArray = mysql_fetch_array($_result);
print_r($_resultArray);
} else {
echo ("Failed!");
}
}
mysql_*functions. They're being deprecated. Instead use PDO (supported as of PHP 5.1) or mysqli (supported as of PHP 4.1). If you're not sure which one to use, read this article.var_dump($_result)give you?