0

I want to connect to my database and get some values of a specific table, that table has a prefix, and that prefix is stored in an array.

$statement = $db->prepare('SELECT * FROM ' . $conf['database']['tableprefix'] . 'candy');

Now I wanted to know, if there is any way, I can replace this $conf['database']['tableprefix'] with a placeholder, as the prefix and the 'candy' string need to be together without space.

DirtyBit
  • 16,613
  • 4
  • 34
  • 55
Ivan Sieder
  • 934
  • 1
  • 10
  • 24
  • I think in the code that you posted they prefix and candy will be together without a space. Is the above code giving any errors ? – Maximus2012 Aug 25 '15 at 21:16
  • @Maximus2012 no, the code works fine, I would just like to have it as variable passed in the ->execute() command if that is possible – Ivan Sieder Aug 25 '15 at 21:19
  • 2
    I think this is what you're looking for and the answer is no: http://stackoverflow.com/questions/182287/can-php-pdo-statements-accept-the-table-name-as-parameter – Maximus2012 Aug 25 '15 at 21:20
  • So the answer is basically NO – RiggsFolly Aug 25 '15 at 22:16

0 Answers0