Actually, here's the problem I get with using global variables in a mysql_query string..
[error begin] PHP Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING [error end] [code begin] $query="SELECT * from tickets where VesselID='$_GET['vesselid']' order by Status DESC, Created ASC"; [code end] Jeff > -----Original Message----- > From: Chris Shiflett [mailto:[EMAIL PROTECTED] > Sent: Friday, October 03, 2003 3:45 PM > To: Jeff McKeon; php > Subject: Re: [PHP] User Authentication Continued.... > > > --- Jeff McKeon <[EMAIL PROTECTED]> wrote: > > The problem I'm having is with the $_GET variables. I guess I'm not > > declaring them correctly. Do I need to set them as soon as the page > > loads, and outside of any functions like so.. > > > > [code start] > > $custid = $_GET['custid']; > > $custname = $_GET['custname']; > > [code end] > > > > Or do I need to declare them in each funtion? > > > > [code start] > > Function blah(){ > > global $custname, $custid; > > > > $custid = $_GET['custid']; > > $custname = $_GET['custname']; > > DO SOME STUFF.... > > } > > $_GET is a superglobal, which just means that it is always > available everywhere. If you assign $custname to > $_GET['custname'], you now have a regular global variable (if > the assignment is done outside a function) or a local > variable (if the assignment is done within a function). > > So, either just use $_GET['custname'] everywhere you need it, > or work with the variable scope like you would have to if it > was anything else. For example: > > 1. $foo = $_GET['foo']; > 2. $foo = 'bar'; > > The variable scope of $foo would be the same, regardless of > which of those assignments were made. > > Hope that helps. > > Chris > > ===== > My Blog > http://shiflett.org/ > HTTP Developer's Handbook > http://httphandbook.org/ > RAMP Training Courses > http://www.nyphp.org/ramp > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php