Jump to content

[SOLVED] getting DB data problem


Raullara

Recommended Posts

Hello everybody again,

 

I'm trying to get the data from the product table and i'm having this problem.

 

I'M NEW ON PRESTASHOP DEVELOPING!!!.

 

well, this is my code.

 

 

$sql = 'SELECT COUNT(*) FROM ' . _DB_PREFIX_ . 'product';

$totalShop = Db::getInstance()->getValue($sql);

$output .= $this->displayConfirmation($this->l("print sql ". "((($sql)))" . "number of products (" . $totalShop) . ")");

 

Well, im doing a simple count and im getting 7, this is okay, but now i want to get the data, i change the SQL by

$sql = 'SELECT * FROM ' . _DB_PREFIX_ . 'product'; (it works fine on phpmyadmin)

 

How can i get the data from the SQL? Using getvalue also? or this just will return the number of rows?

 

Thanks for your time.

 

I solved the problem using the executeS function.

Edited by Raullara (see edit history)
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...