Re: Quotes in querys

From: Date: Wed, 14 Jan 2009 19:48:41 +0000
Subject: Re: Quotes in querys
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-286343@lists.php.net to get a copy of this message
On Wed, 2009-01-14 at 11:17 -0500, MikeP wrote: > Hello, > I am trying to get the following to work: > "Select Netid from Users where Netid = '$_SESSION[phpCAS][user]'" > Netid is a string type. > No matter where of if I put the quotes, I still get array[phpCAS] not the > value. > If there is anything I still have trouble with after all these years its > quoting variables. > Help? > Thanks > Mike > > > I always go with this: "Select Netid from Users where Netid = '{$_SESSION[phpCAS][user]}'" The curly braces allow PHP to use the full variable you intended. Note that you may need single quote marks around the text in each square bracket block or PHP my give you a warning about an unintended string literal. Ash www.ashleysheridan.co.uk

« previous php.general (#286343) next »