bodge
ayy lmao
- Oct 31, 2011
- 406
- 54
Hello Devbest, I got an error while coding my function:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\Users\Owner\Desktop\Billy\xampp-win32-1.8.2-2-VC9\xampp\htdocs\Pony\includes\users.inc.php on line 23
I have no idea what to do :/
Thanks in advanced.
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\Users\Owner\Desktop\Billy\xampp-win32-1.8.2-2-VC9\xampp\htdocs\Pony\includes\users.inc.php on line 23
I have no idea what to do :/
PHP:
//Other functions above
function fetch_user_ids($user_names){
foreach ($user_names as &$name){
$name = mysql_real_escape_string($name);
}
$result = mysql_query("SELECT `id`, `username` FROM `users` WHERE `username` IN ('" . implode("', '", $user_names) . "')");
$names = array();
while (($row = mysql_fetch_assoc($result)) !== false){
$names[$row['username']] = $row['id'];
}
return $names;
}
Thanks in advanced.