Search code examples
phpmysqlprestashopprestashop-1.6

How do I connect to the database with out using the mysql_connect when creating the new module in PrestaShop


I am using the below code to connect to the database in the module to write the several database queries which are not correct it seems, so please tell me what is the correct way of connecting to the database from the new module.

$con = mysql_connect(_DB_SERVER_, _DB_USER_, _DB_PASSWD_);
mysql_select_db(_DB_NAME_);

Solution

  • Please, before read this guidelines to create a new module: How to create a module

    And then this: Best practices of the Db Class

    Including the files like the elPresta says it's old and deprecated method, after that to make a simple query, read what he wrote Matteo Enna.