Jump to content

Converting code to use Prestashop classes?


MrBaseball34

Recommended Posts

I’m writing a new class for Prestashop.

I have some simple db access code in my current that looks like this:

Class Database {

 function query($query){
   $result = mysql_query($query);
   if($this->debug_mode)
   {
     echo mysql_error();
   }
   return $result;
 }

}


And using it in my code:

$db = new Database;
$sql = 'SELECT * FROM TABLE'
$result = $db->query($sql);
if($result) {
 while($row = mysql_fetch_row($result))
   // iterate and do something with row data
 }
}


How would I convert this to Prestashop “speak” using the Db class?
There is not going to be a template used here, only class code. This class
is to generate PDF files from database data so I do not need any presentation.
I already have everything, I just wanted to use PS classes to do it all.

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...