hmmmm I dunno why but if I returned $data from my function and registered it
out side the function it works fine and yes my session_start() is above my
function

John


> I am having problems with my sessions.
>
> This function registered my username password and userid in the session no
> problem.
>
> function login_chk($username, $password){
>  global $user_id;
>  $user_res = mysql_query("SELECT * FROM fan_users WHERE name = '$username'
> and password ='$password'") or die("Line 21 ".mysql_error());
>  $count = mysql_num_rows($user_res);
>  if($count ==1){
>   $user_data = mysql_fetch_row($user_res);
>   $user_id = $user_data[0];
>   if(!session_is_registered("user_id")) session_register("user_id");
>   if(!session_is_registered("username")) session_register("username");
>   if(!session_is_registered("password")) session_register("password");
>   $ok = 2;
>  }
>  else $ok =1;
>
>  return $ok;
> }//E-OF login_chk()
>
> But this function will not  register the details in the session. It
> registeres the variable but puts an ! before it.
>
> function get_data($user_id){
>  global $user_id;
>  $data_res = mysql_query("SELECT t.*, l.* FROM fan_teams as t, fan_league
as
> l WHERE t.league_id = l.lid AND user_id =$user_id") or die("Line 93
> ".mysql_error());
>  $count = mysql_num_rows($data_res);
>  if($count != 1){
>   setup_team_html($user_id);
>   exit();
>  }
>  else{
>   $data = mysql_fetch_row($data_res);
>   if(!session_is_registered("data")) session_register("data");
>  }
>
> }//E-OF get_data($user_id)
>
> The $data array is definatly an array as I have done foreach echo tests
and
> it dumps the information i am needing. but it won't put it in the session.
>
> Would it have anything to do with me testing it on my windoze box?
>
> Cheers
> John Wards
> SportNetwork.net
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to