I'm trying to implement EasyDB into our current system, and having trouble running a query on a different database than the one I specified in my initial connection. Normally I can just run this with mysqli_query-
INSERT INTO
leads.question_answers
SET
question_id = {$_REQUEST['question_id']},
answer_id = {$_REQUEST['answer_id']}
Using that leads.question_answers identifier will obviously let me run that query on the "leads" database instead of the "default" one I set in my mysqli connection. (yes I know those aren't escaped or prepared values, hence why I'm switching to a different solution). With EasyDB I'm trying to run an insert(), looking like this-
$this->conn->insert('leads.question_answers', [
'question_id' => $_REQUEST['question_id'],
'answer_id' => $_REQUEST['answer_id']
]);
But it gives me the error "Separators (.) are not permitted." The EasyDB docs don't mention anything about being able to specify which database to run the query on, and nothing I've tried has worked. This will definitely be a problem since I have 5-6 different databases with different tables that will need to be queried in our setup.
Is there an easy way to do this with EasyDB, or should I drop that and just use mysqli on its own instead?
source https://stackoverflow.com/questions/68168141/run-queries-on-different-databases-in-pdo-easydb
Comments
Post a Comment