Page 1 of 1

Trying to add user profile to user_system ( register system)

Posted: Thu Aug 18, 2011 12:29 am
by wizzuriz
Hello All,

I´v tried to add the user profile to my user register system, I got the login system working just fine but when I try to run some of th query´s from the video user profile I get errors.

Error. Warning: mysql() expects at least 2 parameters, 1 given in /Applications/XAMPP/xamppfiles/htdocs/user_system/core/inc/user.inc.php on line 63

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, null given in /Applications/XAMPP/xamppfiles/htdocs/user_system/core/inc/user.inc.php on line 65
// to get the username. 
$u_name = $_SESSION['username'];

// try to get user information from data table. 
function fetch_user_info($u_name){
   
   $sql = "SELECT
        `user_name` AS `username`,
        `user_firstname` AS `firstname`,
        `user_lastname` AS `lastname`,
        `user_weight` AS `weight`, 
        `user_hight` AS `hight`
        FROM `users`
        WHERE `user_name` ='{$u_name}'";
        // result is line 63.
        $result = mysql($sql);
        // line 65 is return. 
        return mysql_fetch_assoc($result);       
}
I can add the user data just fine and review it all in the table but I can´t get it out on the website.

please let me know if you think you know what I´m missing here.

best regards
Wizzuriz

Re: Trying to add user profile to user_system ( register sys

Posted: Thu Aug 18, 2011 10:57 am
by jacek
You should be using the mysql_query function. Or if mysql() is one that you defined then you should be passing the correct number of parameters to it.