Jump to content

cflores59

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cflores59's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Took me awhile to figure out WHERE in the code to actually place the session start, but now it works fine==thanks sooooo much!!! Also, the reason I didn't get it to work the first time was because I didn't understand that session-start was needed in EVERY page it is referenced. This is not intuitive (to me) as it implies the start of a new session on every page. So thanks for making that clear. It did the trick!
  2. Actually, I had tried that first. $_SESSION['UserID'] = trim($text, " .php"); //remove extension, leaving userid and echo "user is ".$_SESSION['UserID']; Feeling dumb... Appreciate your help
  3. I'm a newbie and notice that all my .php pages (files, scripts--what are they called?) begin with <?php /* Change next two lines if using online*/ $db=".........."; $link = mysql_connect('localhost', ....................'); if (! $link) die(mysql_error()); mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error()); and end with mysql_close($link); ?> Is this standard or should I leave it open til I'm finished and then close?????????????????? Altho I experimented with not closing & opening & it seemed that by doing so I couldn't access the next table I was after.
  4. I am presuming that I set a global variable so that I can retrieve it on a different page...My filename is userid; and I will need this in many different pages. I set it thusly: mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error()); $long=$_SERVER['PHP_SELF']; //get path $text = substr(strrchr($long, "/"), 1); //get file name+extension $UserID = trim($text, " .php"); //remove extension, leaving userid Globals["UserID"]; and in a different file try to retrieve it thusly: echo "user is ".$GLOBALS["UserID"]; but all I ever see is "user is"------any help appreciated.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.