// This is to get the username $u_id= $_SESSION['username']; // here I take the username and make it to user_id. function get_userid($u_id){ $sql = "SELECT `user_id` AS `id`, `user_weight` AS `weight` FROM `users` WHERE `user_name` ='{$u_id}'"; $data = mysql_query($sql); return mysql_result($data, 0); }
Now I think should me a Mysql_fetch_array here but what my problem is I don´t know how to pull the user id out from the other function.
I can echo it out on the protected.php with $user_info = get_userid($u_id); + <p>User id: <?php echo $user_info['id']; ?></p> That shows the right user id but if I try the fetch array from the user profile video I get many errors and I did try to check them but its not syntax errors.
I did try to create a myslq_fetch_array(); for todays now but its still not working. any idea?
Best regards
Wuzzuriz