oh hell.

Do I ever feel stupid now.  That explains that test script perfectly....
now I just have to figure out whats wrong with the rest of my site....

Obviously, too much "What-the-f..." and not enough "lets look at this
logically" occured.

Sorry about that.  I'll crawl back under my rock now.

> -----Original Message-----
> From: Steve Werby [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 13, 2001 12:26 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] mysql_fetch_array and row referencing
> under 4.0.4pl1
>
>
> "Scott Brown" <[EMAIL PROTECTED]> wrote:
> > I grabbed an example of of php.net dealing with just arrays
> and it works
> ...
> >
> > Here's what I'm seeing - THIS WORKS:
>
> <snip>
> >         while ( $row = mysql_fetch_array($rslt) )
> >         {
> >                 echo "<TR>\n";
> >                 echo "<TD>$row[ID]</tD>";
> </snip>
>
> > But put any one of these $row[...] with quotes around their
> fieldnames and
> I
> > get:
> >
> > Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
> > `T_NUM_STRING' in /home/testnexus/public_html/test.php on line 16
> >
> > (when line 16 =
> >                 echo "<TD>$row["ID"]</tD>";
>
> The double quotes enclose the contents of the echo statement,
> but PHP chokes
> because you have double quotes inside the echo statement.  If
> the exact line
> above worked under PHP3.x I'm surprised.  Solutions include:
>
> escaping the double quotes
> echo "<TD>$row[\"ID\"]</TD>";
>
> using no quotes or single quotes:
> echo "<TD>$row['ID']</TD>";
> echo "<TD>$row[ID]</TD>";
>
> breaking apart the echo statement:
> echo "<TD>" . $row["ID"] . "</TD>";
>
> I don't think there's any way around this.  If you got it to work
> differently in PHP3 I'd like to know how.  If for some reason
> you have a ton
> of code you have to change now, you can write a PHP script which uses
> regular expressions to find the double quotes to replace,
> write out the new
> files and cycle through all your files.  It really wouldn't
> be that hard,
> but I still suspect that the double quotes would have been a
> problem in PHP3
> too.
>
> --
> Steve Werby
> COO
> 24-7 Computer Services, LLC
> Tel: 804.817.2470
> http://www.247computing.com/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to