Welcome Guest, Not a member yet? Register   Sign In
active record for [where date >= now()]
#10

[eluser]Scott - Beyond Coding[/eluser]
[quote author="RaZoR LeGaCy" date="1186269580"]
Code:
mysql_select_db($database_HH, $HH);
$query_events = "SELECT * FROM hh_events WHERE  dvd = 1 AND `date` >= NOW() OR theater = 1 AND `date` >= NOW() ORDER BY `date` ASC LIMIT 0,6";
$events = mysql_query($query_events, $HH) or die(mysql_error());
$totalRows_events = mysql_num_rows($events);
[/quote]

If you just want to rewrite that manual SQL for AR, I'd try something along the lines of:
Code:
$this->db->select();
$this->db->from('hh_events');
$this->db->where('(dvd = 1 AND date >= NOW()) OR (theater = 1 AND date >= NOW())');
$this->db->limit('6');
$this->db->order_by('date ASC');

Haven't tested the code obviously but should be something along those lines.. Smile


Messages In This Thread
active record for [where date >= now()] - by El Forum - 08-01-2007, 08:26 PM
active record for [where date >= now()] - by El Forum - 08-01-2007, 08:35 PM
active record for [where date >= now()] - by El Forum - 08-01-2007, 08:38 PM
active record for [where date >= now()] - by El Forum - 08-02-2007, 09:22 AM
active record for [where date >= now()] - by El Forum - 08-02-2007, 05:17 PM
active record for [where date >= now()] - by El Forum - 08-02-2007, 06:18 PM
active record for [where date >= now()] - by El Forum - 08-03-2007, 06:48 AM
active record for [where date >= now()] - by El Forum - 08-04-2007, 12:19 PM
active record for [where date >= now()] - by El Forum - 08-06-2007, 04:12 PM
active record for [where date >= now()] - by El Forum - 08-06-2007, 07:06 PM
active record for [where date >= now()] - by El Forum - 08-06-2007, 07:45 PM
active record for [where date >= now()] - by El Forum - 08-06-2007, 09:52 PM
active record for [where date >= now()] - by El Forum - 09-23-2007, 10:19 AM
active record for [where date >= now()] - by El Forum - 09-23-2007, 08:50 PM
active record for [where date >= now()] - by El Forum - 09-23-2007, 11:01 PM
active record for [where date >= now()] - by El Forum - 09-24-2007, 03:48 AM
active record for [where date >= now()] - by El Forum - 09-28-2007, 12:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB