I have received a source code of a pharmacy POS in PHP and mySQL db but i am unable to get it connected to the DB. First of all, the DB doesn't show under the database column within the myPHPAdmin, i am only able able to see other previous databases; i do not understand is it because the said DB is in SQL query or what and the errot message i get is"Unable to select database", i have tried all methods to my understanding to locate the DB like changing the PHP file which contains the code to connect to the DB to no avail.
A full explanation or demonstration of how to get a PHP source code with an existing database to run would be a great help.
Here's a snipet of the connect code:
<?php
/* Database config */
$db_host = 'localhost';
$db_user = 'root';
$db_pass = '';
$db_database = 'sales';
/* End config */
$db = new PDO('mysql:host='.$db_host.';dbname='.$db_database, $db_user, $db_pass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
?>
Thank you in advance.
Regards,
Tech Central.
A full explanation or demonstration of how to get a PHP source code with an existing database to run would be a great help.
Here's a snipet of the connect code:
<?php
/* Database config */
$db_host = 'localhost';
$db_user = 'root';
$db_pass = '';
$db_database = 'sales';
/* End config */
$db = new PDO('mysql:host='.$db_host.';dbname='.$db_database, $db_user, $db_pass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
?>
Thank you in advance.
Regards,
Tech Central.