• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database driver error

#1
Exclamation 
Hello, make a request to the database:

PHP Code:
// $this->db->last_query()
SELECT COUNT(*) AS `numrows`
FROM `lids`
WHERE   (
`
lids`.`date_inspection` >= '2018-07-08 00:00:00'
AND `lids`.`date_inspection` <= '2018-08-08 23:59:59'
 


Show results: 0
   

When performing the same query directly in the database get:
Show results: 1558
   
Reply

#2
I'm sorry, I ran the query on another database. Whoops! ))
Reply

#3
Your query absolutely right. i don't know why it is not working.please use below query as a alternative.

$row1 = $this->db->query("SELECT COUNT(*) AS `numrows` FROM `lids` WHERE `lids`.`date_inspection` >= '2016-10-14 00:00:00' AND `lids`.`date_inspection` <= '2016-10-15 23:59:59'")->row();

$row2 = $this->db->query("SELECT COUNT(*) AS `numrows` FROM `lids` WHERE `date_inspection` >= '2016-10-14 00:00:00' AND `date_inspection` <= '2016-10-15 23:59:59'")->row();

$row3 = $this->db->query("SELECT COUNT(*) AS numrows FROM lids WHERE date_inspection BETWEEN '2016-10-14 00:00:00' and '2016-10-15 23:59:59'")->row();

print_r($row1->numrows);
print_r($row2->numrows);
print_r($row3->numrows);

Above three query is may helpful.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.