Thursday, June 30, 2022

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

Issue

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.



Answered By - marsaldev
Answer Checked By - Candace Johnson (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.