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

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

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