Jump to content

Interact with the DB in new PHP file


Recommended Posts

Hi, I need to run a Cron Job that will modify a DB table depending of the city that was selected by the user in the registration.

 

First I'm making the queries that will update or insert rows in the DB. I don't know other way to access and modify the DB in Prestashop without a creating a new PHP file. So, this is working:

<?php


include '../config/settings.inc.php';
include '../config/defines.inc.php';
include '../config/config.inc.php';
include '../init.php';


$query = "SELECT DISTINCT `id_group` FROM "._DB_PREFIX_."group_lang WHERE `name`='blabla'";
$result= Db::getInstance()->ExecuteS($query);
var_dump($result);
?>

But I added the file to /public_html/js because is the only place I found that could be accessed from the browser. I'm sure there's a better way to do this without putting the PHP file in the JS directory, but I don't know how. Please help.

 

Thanks for the response!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...