Trying to add user profile to user_system ( register system)

Any tutorials (or useful resources) should go in here.
Post Reply
wizzuriz
Posts: 53
Joined: Mon Jul 25, 2011 4:22 pm

Trying to add user profile to user_system ( register system)

Post 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
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

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

Post 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.
Image
Post Reply