This topic is locked

Inserting into another database

3/23/2018 8:28:23 PM
PHPRunner General questions
P
PaulM author

I'm trying to add a row into another database and have now tried several way but am continuously getting an error. The latest way is:
$hostDb='mysql:host= "localhost";dbname="EMS" ';

$user='xxxxxx';

$password='xxxxxx';

$connection = PDO($hostDb, $user, $password);

$query = "INSERT INTO SCentre (SC_SR_name, SC_date) values (".$values[SR_name]."',',curdate())";

$result=$connection->$query;
But unfortunately I get the error:

Fatal error: Call to undefined function PDO() in /volume1/web/em_dev/include/Support_Request_events.php on line 67
Can anybody help Please?

M
mersintarim 3/24/2018

$connection =new PDO($hostDb, $user, $password);
Add "new" word your connection