CodeIgniter Forums

Full Version: Database query problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]nmormino[/eluser]
I tried using the database helper to write a query that would ultimately have the same function as

SELECT * FROM table_name WHERE date >= CURDATE()

I made an attempt at this by using

$this->db->where("date >= "=>date('Y-m-d'));
$this->db->orderby('date DESC');
$query = $this->db->get('table_name');

But this didn't return anything where as the manual SQL statement does return results.

any ideas?

El Forum

[eluser]alexsancho[/eluser]
try this

Code:
$this->db->where("date >=", date('Y-m-d'));
$this->db->orderby('date', 'desc');
$query = $this->db->get('table_name');

El Forum

[eluser]nmormino[/eluser]
that did it!

Thanks