|
Posted by ZeldorBlat on 07/13/07 13:59
On Jul 13, 9:56 am, bill <nob...@spamcop.net> wrote:
> I am trying to write clean code but keep having trouble deciding
> when to quote an array index and when not to.
>
> sometimes when I quote an array index inside of double quotes I
> get an error about enased whitespace (to my best memory)
>
> AT other times I get an undefined index notice as below:
>
> Notice: Undefined index: last_reminder_id in...
>
> the 2nd line (which wraps to the 3rd in this posting
> is the one listed in the error message:
>
> $sql = "SELECT * from notes
> where recall_date > '0' and recall_date <= '$now' and id >
> '$_SESSION[last_reminder_id]'";
>
> what is the correct syntax and/or can anyone point me at a
> reference that will explain this ?
>
> bill
If you have an array called $foo with a key called "bar" the correct
syntax is like this:
$foo['bar'];
or
$foo["bar"];
or
$key = 'bar';
$foo[$key];
Navigation:
[Reply to this message]
|