Re: [PHP] When and when not to use ' and "

2007-06-02 Thread Richard Lynch
On Sat, June 2, 2007 3:15 pm, Brian Seymour wrote: > $bar = $foo['$colVal']; // didn't work > $bar = $foo['{$colVal}']; // didn't work > $bar = $foo[$colVal]; // worked > $bar = $foo['id']; // obviously worked > > What I don't understand is why the first or second option didn't work. > > Can anybod

Re: [PHP] When and when not to use ' and "

2007-06-02 Thread Daniel Brown
On 6/2/07, Brian Seymour <[EMAIL PROTECTED]> wrote: I noticed today when I was using mysql_fetch_array something weird happened. Database: | id | 1 Code: $colVal = "id"; $foo=mysql_fetch_array($someresult, MYSQL_ASSOC); Now all I wanted to do was get the value of 1 into the variable $bar. Plea