PHP Classes

Total Records Count

Recommend this page to a friend!

      Eyesis Data Grid Control  >  All threads  >  Total Records Count  >  (Un) Subscribe thread alerts  
Subject:Total Records Count
Summary:Total Records Count with a Where condition
Messages:6
Author:Sergio Lanza
Date:2008-12-04 16:50:05
Update:2009-05-15 14:58:53
 

  1. Total Records Count   Reply   Report abuse  
Picture of Sergio Lanza Sergio Lanza - 2008-12-04 16:50:05
Hi, I've just tested your datagrid class and if you use a where condition into de SQL stament, appears the total results of all records in the database, no the selected with the WHERE condition.

Any Idea? or I'm doing something wrong...

Best,

Sergio.

  2. Re: Total Records Count   Reply   Report abuse  
Picture of Mike Frank Mike Frank - 2008-12-05 14:55:13 - In reply to message 1 from Sergio Lanza
This issue started in v1.1.4 and was fixed in v1.1.6.

  3. Re: Total Records Count   Reply   Report abuse  
Picture of Mauricio Simão Janz Mauricio Simão Janz - 2009-03-11 16:16:53 - In reply to message 2 from Mike Frank
Hi, I´ve use yours class in 2 projects. But, the last one I had a problem with Total Records Count in PrintTable function in class.eyedatagrid.inc.php.

I have that situation:

$fields = "f.desc_fabricante fabricante, p.desc_produto produto,"
. "\n i.desc_item descricao, i.preco_item preco,"
. "\n i.shw_preco_item AS 'mostrar preco', i.foto_item foto, i.tb_item codigo"
;

$tables = "TB_Item i, TB_Produto p, TB_Fabricante f";

$where = "p.tb_produto = i.tb_produto and"
. "\n f.tb_fabricante = i.tb_fabricante"
;

// Set the query
$grid -> setQuery( $fields, $tables, '', $where );


When execute this code :


// Count the number of rows without the limit clause
$this->row_count = (int) $this->_db->selectOneValue('COUNT(*)', $this->select_table, $filter_query); // Old code which does not support large data sets: $this->_db->countRows($query);

The error showed below occurs:

Notice: Uncovered an error in your SQL query script: "Table 'Primus.TB_Item i, TB_Produto p, TB_Fabricante f' doesn't exist" in /home/httpd/vhosts/primuscapacetes.com.br/httpdocs/boutique/admin/includes/eyeDataGrid/class.eyemysqladap.inc.php on line 132

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/httpd/vhosts/primuscapacetes.com.br/httpdocs/boutique/admin/includes/eyeDataGrid/class.eyemysqladap.inc.php on line 367

I think is because the query mounted is :
SELECT COUNT(*) FROM `TB_Item i, TB_Produto p, TB_Fabricante f` WHERE (p.tb_produto = i.tb_produto and
f.tb_fabricante = i.tb_fabricante) LIMIT 1

And it´s don´t work in MySql.

Is There any new version to correct this or I made some mistakes ?

Thanks !

  4. Re: Total Records Count   Reply   Report abuse  
Picture of Mauricio Simão Janz Mauricio Simão Janz - 2009-03-11 16:18:32 - In reply to message 3 from Mauricio Simão Janz
My version is 1.1.6

Thanks !

Mauricio

  5. Re: Total Records Count   Reply   Report abuse  
Picture of Felix Quims Felix Quims - 2009-05-13 08:11:21 - In reply to message 4 from Mauricio Simão Janz
Hi guy'z......

I am Beginner.....

I need help regarding this "class.eyemysqladap.inc.php". I've encounter a problem in database.

This what I've encounter:

Notice: Uncovered an error in your SQL query script: "No database selected" in C:\wamp\www\Web Page Design\class.eyemysqladap.inc.php on line 122

Oops! We ran into a problem while trying to output the table. Click here to reset the table or HERE to review the error.

if I click the word HERE there is a message out and it say's:

"No Database Selected"


What should I do???

My Pleasure.........

Felix

  6. Re: Total Records Count   Reply   Report abuse  
Picture of Alejandro Borrego Alejandro Borrego - 2009-05-15 14:58:53 - In reply to message 3 from Mauricio Simão Janz
creo que el problema esta en:

public function select($fields, $table, $where = false, $orderby = false, $limit = false){...

Line 194.
$this->query("SELECT " . $fields . " FROM `" . $table . "`" . $where . $orderby . $limit);

el problema se soluciona modificando la linea

$this->query("SELECT " . $fields . " FROM " . $table . " " . $where . $orderby . $limit);

en mi caso me funciono, espero haber ayudado.