Hi, i get an Error, but cant understand why i get this :S
The error is like this: Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/techozin/public_html/multiligase/core/user.inc.php on line 31

The page codes:

user.inc.php

<?php
 
function fetch_users() {
        $result = mysql_query('SELECT `user_id` AS `id`, `user_name` AS `username` FROM `users`');
       
        $users = array();
       
        while (($row = mysql_fetch_assoc($result)) !== false) {
                $users[] = $row;
        }      
       
        return $users;
}

function fetch_user_info($uid) {
        $uid = (int)$uid;
       
        $sql = "SELECT
                                `user_name` AS `username`,
                                `user_firstname` AS `firstname`,
                                `user_lastname` AS `lastname`,
                                `user_email` AS `email`,
                                `user_about` 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);
}
?>

Plizz help :)

You get that error when your query fails, perhaps because $uid is not valid or not set.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.