Re: [PHP] Quotes in querys

2009-01-15 Thread Thodoris
It is over head, but it caches the execution plan for multiple runs of the script. So different users with different data will use the same cached query on the database. Saving processing time. It also prevents SQL injection on the fly because you are indicating what data type each place

[PHP] Quotes in querys

2009-01-14 Thread MikeP
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

RES: [PHP] Quotes in querys

2009-01-14 Thread Jônatas Zechim
Try session_start(); $sql = SELECT Netid FROM User WHERE Netid='.$_SESSION['phpCAS']['user'].'; -Mensagem original- De: MikeP [mailto:mpel...@princeton.edu] Enviada em: quarta-feira, 14 de janeiro de 2009 14:17 Para: php-general@lists.php.net Assunto: [PHP] Quotes in querys Hello, I

Re: [PHP] Quotes in querys

2009-01-14 Thread Robert Stankiewicz
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. Maybe try this : $q = 'Select Netid from Users where Netid = ' .

Re: [PHP] Quotes in querys

2009-01-14 Thread ceo
You can only interpolate ONE level of array or object indirection in a string. WORKS: ... $foo[x] ... ... $foo-x ... FAILS: ... $foo[x][y] ... ... $foo-x-y ... //almost for sure it fails, never tried... You can use curly braces in side a string to evaluate something: WORKS: ...

Re: [PHP] Quotes in querys

2009-01-14 Thread Eric Butera
On Wed, Jan 14, 2009 at 11:17 AM, MikeP mpel...@princeton.edu 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

Re: [PHP] Quotes in querys

2009-01-14 Thread MikeP
Eric Butera eric.but...@gmail.com wrote in message news:6a8639eb0901140825h1d603d01i3ffcce919dca6...@mail.gmail.com... On Wed, Jan 14, 2009 at 11:17 AM, MikeP mpel...@princeton.edu wrote: Hello, I am trying to get the following to work: Select Netid from Users where Netid =

Re: [PHP] Quotes in querys

2009-01-14 Thread Eric Butera
On Wed, Jan 14, 2009 at 11:34 AM, MikeP mpel...@princeton.edu wrote: Eric Butera eric.but...@gmail.com wrote in message news:6a8639eb0901140825h1d603d01i3ffcce919dca6...@mail.gmail.com... On Wed, Jan 14, 2009 at 11:17 AM, MikeP mpel...@princeton.edu wrote: Hello, I am trying to get the

Re: [PHP] Quotes in querys

2009-01-14 Thread MikeP
Thanks, Thats the kind of help I was looking for. Mike c...@l-i-e.com wrote in message news:20090114162142.65944.qm...@o2.hostbaby.com... You can only interpolate ONE level of array or object indirection in a string. WORKS: ... $foo[x] ... ... $foo-x ... FAILS: ... $foo[x][y] ... ...

Re: [PHP] Quotes in querys

2009-01-14 Thread ceo
Doesn't anybody use prepared statements these days? It even helps MySQL AND Oracle cache an execution plan... Forgive me if I'm wrong, but: Caching an execution plan for a prepared statement that is run only once in the script is just overhead, no? Or can it actually re-use the same

Re: [PHP] Quotes in querys

2009-01-14 Thread Kyle Terry
On Wed, Jan 14, 2009 at 8:41 AM, MikeP mpel...@princeton.edu wrote: Thanks, Thats the kind of help I was looking for. Mike c...@l-i-e.com wrote in message news:20090114162142.65944.qm...@o2.hostbaby.com... You can only interpolate ONE level of array or object indirection in a string.

Re: [PHP] Quotes in querys

2009-01-14 Thread Kyle Terry
On Wed, Jan 14, 2009 at 9:11 AM, c...@l-i-e.com wrote: Doesn't anybody use prepared statements these days? It even helps MySQL AND Oracle cache an execution plan... Forgive me if I'm wrong, but: Caching an execution plan for a prepared statement that is run only once in the script is

Fwd: [PHP] Quotes in querys

2009-01-14 Thread Kyle Terry
On Wed, Jan 14, 2009 at 10:07 AM, Kyle Terry k...@kyleterry.com wrote: On Wed, Jan 14, 2009 at 9:11 AM, c...@l-i-e.com wrote: Doesn't anybody use prepared statements these days? It even helps MySQL AND Oracle cache an execution plan... Forgive me if I'm wrong, but: Caching an

Re: [PHP] Quotes in querys

2009-01-14 Thread Ashley Sheridan
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

Re: Fwd: [PHP] Quotes in querys

2009-01-14 Thread Ashley Sheridan
On Wed, 2009-01-14 at 10:11 -0800, Kyle Terry wrote: On Wed, Jan 14, 2009 at 10:07 AM, Kyle Terry k...@kyleterry.com wrote: On Wed, Jan 14, 2009 at 9:11 AM, c...@l-i-e.com wrote: Doesn't anybody use prepared statements these days? It even helps MySQL AND Oracle cache an

Re: [PHP] Quotes in querys

2009-01-14 Thread Frank Stanovcak
Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1231962521.3613.13.ca...@localhost.localdomain... 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

Re: [PHP] Quotes in querys

2009-01-14 Thread Ashley Sheridan
On Wed, 2009-01-14 at 15:24 -0500, Frank Stanovcak wrote: Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1231962521.3613.13.ca...@localhost.localdomain... On Wed, 2009-01-14 at 11:17 -0500, MikeP wrote: Hello, I am trying to get the following to work: Select Netid from

Re: [PHP] Quotes in querys

2009-01-14 Thread Chris
It is over head, but it caches the execution plan for multiple runs of the script. So different users with different data will use the same cached query on the database. Saving processing time. It also prevents SQL injection on the fly because you are indicating what data type each place