Use of $CONFIG in a query Use of $CONFIG in a query
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Use of $CONFIG in a query

Started by just_some_guy, November 01, 2007, 11:03:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

just_some_guy

Hello,

Not quite sure what is wrong here, the query works fine using `cpg1411_config` but when i use {$CONFIG['TABLE_CONFIG']} in replace of the other name i get an unexpected T_STRING. Its for my plugin and i have also globlized CONFIG too before this.

this works -


$sql = 'INSERT INTO `cpg1411_config` (`name`, `value`) VALUES (\'text\', \'text'\' ), (\'text\', \'text'\' ),(\'text\', \'text'\ ), (\'text\', \'text'\), (\'text\', \'text\' );';
cpg_db_query($sql);


this does not -


$sql = 'INSERT INTO {$CONFIG['TABLE_CONFIG']}  (`name`, `value`) VALUES (\'text\', \'text\' ), (\'text\', \'text\'),(\'text\', \'text\' ), (\'text\', \'text\'), (\'text\', \'text\' );';
cpg_db_query($sql);


any ideas?

thanks,
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

Nibbler

{$CONFIG['TABLE_CONFIG']} only works within double quotes. Please don't ask general PHP coding questions here.

Joachim Müller

You should also review your use of backticks and single quotes.

just_some_guy

Ok thanks guys, i managed to solve the problem by comparing the code amongst the code used in sami's copperad plugin. Turns out the problem was the (`name`, `value`) . and i used " .$CONFIG['TABLE_PREFIX']. " instead
Thanks!
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums