User Profile with your login system.
Re: User Profile with your login system.
waiting for jacek to look at code 
			
			
									
						
										
						Re: User Profile with your login system.
It all looks very fine and neat except for this little bithys wrote:waiting for jacek to look at code
function fetch_current_user_id($username){
$username = mysql_real_escape_string($username);
$sql = 'SELECT `user_id` FROM `users` WHERE `user_name` = '{$username}'';
 
$result = mysql_query($sql);
 
return mysql_result($result, 0);
 
}
 
if(empty($_SESSION['uid'])) {
$_SESSION['uid'] = fetch_current_user_id($_SESSION['username']);
 
}
So lets neaten that upfunction fetch_current_user_id($username){
	$username = mysql_real_escape_string($username);
	
	$sql = 'SELECT `user_id` FROM `users` WHERE `user_name` = '{$username}'';
	$result = mysql_query($sql);
	
	return mysql_result($result, 0);
}
if(empty($_SESSION['uid'])){
	$_SESSION['uid'] = fetch_current_user_id($_SESSION['username']); 
}
Now, you should can calling the function in the init file (not in the function definition file) once you have stored the username in the session.There is also a fairly obvious syntax error on this line, which you should be able to spot
$sql = 'SELECT `user_id` FROM `users` WHERE `user_name` = '{$username}'';Re: User Profile with your login system.
Can it be this?
			
			
									
						
										
						$sql = 'SELECT `user_name` FROM `users` WHERE `user_id` = '{$username}'';Re: User Profile with your login system.
No, you want to query the username, I'll just tell you 
 It should be this
			
			
									
						
										
						    $sql = "SELECT `user_id` FROM `users` WHERE `user_name` = '{$username}'";Re: User Profile with your login system.
Omg :d and i couldt see that hehe sorry for that mate 
i have a question more how much code do i have to make if i want to see when users are online ? like when u click user list then u see the name " Bob (online)" .
Hys
			
			
									
						
										
						i have a question more how much code do i have to make if i want to see when users are online ? like when u click user list then u see the name " Bob (online)" .
Hys
Re: User Profile with your login system.
i have a problem now :s i deleted all my mysql and can't do the same as i had done 
			
			
									
						
										
						Re: User Profile with your login system.
Why is that?hys wrote: can't do the same as i had done
Re: User Profile with your login system.
i found out 
 thanks anyway :d
			
			
									
						
										
						