Advanced search  

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

Pages: [1]   Go Down

Author Topic: Use of $CONFIG in a query  (Read 3427 times)

0 Members and 1 Guest are viewing this topic.

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Use of $CONFIG in a query
« on: November 01, 2007, 11:03:10 pm »

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 -

Code: [Select]
$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 -

Code: [Select]
$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,
« Last Edit: November 03, 2007, 06:22:14 pm by GauGau »
Logged
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

  • Guest
Re: Use of $CONFIG in a query
« Reply #1 on: November 02, 2007, 12:39:30 am »

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Use of $CONFIG in a query
« Reply #2 on: November 02, 2007, 07:23:59 am »

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

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Use of $CONFIG in a query
« Reply #3 on: November 02, 2007, 07:51:27 pm »

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!
Logged
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
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 19 queries.