Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\lr\core\functions\users.php on line 12
i have provided the code for the function and the code it links to on another file
users.php
function user_data($user_id) {
$data = array();
$user_id = (int)$user_id;
$func_num_args = func_num_args();
$func_get_args = func_get_args();
if ($func_num_args > 1) {
unset($func_get_args[0]);
$fields = '`' . implode('`,`', $func_get_args) . '`';
//error seems to be appearing on the line below with:(mysql_fetch_assoc)
$data = mysql_fetch_assoc(mysql_query("SELECT $fields FROM `users` WHERE `user_id` = $user_id"));
print_r($data);
die();
return $data;
}
}
init.php
session_start();
//error_reporting(0);
require('database/connect.php');
require('functions/general.php');
require('functions/users.php');
if (logged_in() === TRUE) {
$session_user_id = $_SESSION['user_id'];
$user_data = user_data($session_user_id, 'user_id','username','password', 'firstname', 'lastname', 'email');
}
$errors = array();
?>

New Topic/Question
Reply



MultiQuote








|