I have a ticket system I set up for multiple websites. Each website has its own database and the tables in each database are the same on all website with a few minor changes on each site.
I'm creating a CMS to manage all the sites from one website.
I can query my databases and have variable setup like this to call each database.
$database_1 = 'cats';$database_2 = 'dogs';
Then call the database like this in a query:
SELECT `whatever` FROM {$database_1}.`support_ticket`..etc
My question is how can I insert data into the database tables?
This works for me:
$addticket = DB::getInstance()->insert('cats.`st_messages`', array( etc..
But I want it to work like this:
$addticket = DB::getInstance()->insert('{$database_1}.`st_messages`', array( etc..
Not sure why that won't work..?
So to reiterate:
$database_1 = 'cats';- This works:
'cats.st_messages' - This is not working, but want it to:
'{$database_1}.st_messages'
If someone could explain what I'm doing wrong by using the variable in the insert query I would appreciate it.
$database_1 = 'cats';,but when running my insert line'{$database_1}.st_messages'it's not reading it as'cats.st_messages'......What I'm asking is what is wrong with this:'{$database_1}.st_messages'..?