PHP 4.2.3 MySQL mysql_query quoting syntax.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings,

Prior to PHP 4.2.3, when inserting values from an array into mysql I could
do the following:
(assuming that $a is an array())

$qid = mysql_query(" INSERT  INTO  table  (info)  VALUES ('$a[2]')  ");

However this logic now fails with the following error:
Parse error: parse error, expecting `']'' in /path/to/script/my_query.php on
line 123

Thus making me have to rewrite the query as:

$qid = mysql_query(" INSERT  INTO  table  (info)  VALUES ( ' ".$a["2"]." ' )
");

What happened?  Is this just a PHP.INI setting, or was PHP just being
leanent and now it's gotten strict and being a bully about this?  .. I would
really prefer not to have to re-write my entire projects queries because of
this change.  Any information on how to go back to the old behaviour or why
the old behaviour is now unacceptable are greatly apprecaited.

    Thank you,
-V. Twilight ;.,


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux