Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\user_profile\core\inc\user.inc.php on line 8
Array ( )
Code (PHP)
<?php
function fetch_users(){
$result = mysql_query('SELECT `user_id` AS `id`, `user_username` AS `username` FROM `users`');
$users = array();
while (($row = mysql_fetch_assoc($resule)) !== false){
$users[] = $row;
}
return $users;
}
?>
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\user_profile\core\inc\user.inc.php on line 33
นิอ่ะคับ ช่วยดูหน่อย
Code (PHP)
<?php
function fetch_users(){
$result = mysql_query('SELECT `user_id` AS `id`, `user_username` AS `username` FROM `users`');
$users = array();
while (($row = mysql_fetch_assoc($result)) !== false){
$users[] = $row;
}
return $users;
}
//profile infomation
function fetch_user_info($uid){
$uid = (int)$uid;
$sql = "SELECT
`user_username` AS `username`,
`user_firstname` AS `firstname`,
`user_lastname` AS `lastname`,
`user_email` AS `email`,
`user_anout` AS `about`,
`user_location` AS `location`,
`user_gender` AS `gender`
FROM `users`
WHERE `user_id` = {$uid}";
$result = mysql_query($sql);
return mysql_fetch_assoc($result);
}
?>
<?php
function fetch_users(){
$sql = "SELECT `user_id` AS `id`, `user_username` AS `username` FROM `users`";
$result = mysql_query($sql) or die(mysql_error());
$users = array();
while (($row = mysql_fetch_assoc($result)) !== false){
$users[] = $row;
}
return $users;
}
//profile infomation
function fetch_user_info($uid){
$uid = (int)$uid;
$sql = "SELECT
`user_username` AS `username`,
`user_firstname` AS `firstname`,
`user_lastname` AS `lastname`,
`user_email` AS `email`,
`user_anout` AS `about`,
`user_location` AS `location`,
`user_gender` AS `gender`
FROM `users`
WHERE `user_id` = {$uid}";
$result = mysql_query($sql) or die(mysql_error());
return mysql_fetch_assoc($result);
}
?>