CodeIgniter Forums

Full Version: Calculate 2 fields with Active records
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a table with fields
[Image: Rz9ByFZ_RUGgBsAsGxTaiA.png]

I want to looking for some records expired date in 6days.
today - test_time (created date) < duration - 6 days

My code don't work


$current_time = time();
$pre7day = $current_time - 7*60*60*24;
$next7day = $current_time + 7*60*60*24;
$this->db->where("duration * con <=", $next7day);
return $this->db->get();
This is a error:
Quote:Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`con` <= 1508605807' at line 3

SELECT `ospos_test`.*FROM `ospos_test`WHERE `duration *` `con` <= 1508605807

Filename: vendor/codeigniter/framework/system/database/DB_driver.php

Line Number: 691

Please help me.

PHP Code:
$this->db->where("(duration * con) <="$next7day);