Welcome Guest, Not a member yet? Register   Sign In
CI Database Error when Setting Timezone in MySQL
#2

[eluser]thdls55[/eluser]
Hi chuckleberry13,

MySQL batch queries are not supported in PHP.

Try something like the following:

Code:
$sql = "SET time_zone = TIME_FORMAT(SEC_TO_TIME('".$offset."'),'%H:%i')";

$this->db->query($sql);

$sql = "SELECT YEAR(`timestamp`) AS year, WEEKOFYEAR(`timestamp`) AS week, DATE(`timestamp`) AS day, `user_id`, `list_id`, MIN(timestamp) as first_call, MAX(TIMESTAMP) as last_call, TIME_TO_SEC(TIMEDIFF(MAX( TIMESTAMP ), MIN(timestamp))) as total_time
            FROM (`".$this->transaction_table."`)
            WHERE `list_id` IN ('".implode("','",$list_ids)."')
            GROUP BY `day`, `list_id` ORDER BY `week`  DESC";

return $this->db->query($sql);


Messages In This Thread
CI Database Error when Setting Timezone in MySQL - by El Forum - 10-28-2009, 07:13 PM
CI Database Error when Setting Timezone in MySQL - by El Forum - 10-28-2009, 08:10 PM
CI Database Error when Setting Timezone in MySQL - by El Forum - 10-28-2009, 09:43 PM
CI Database Error when Setting Timezone in MySQL - by El Forum - 10-28-2009, 10:05 PM
CI Database Error when Setting Timezone in MySQL - by El Forum - 10-29-2009, 11:34 AM
CI Database Error when Setting Timezone in MySQL - by El Forum - 10-29-2009, 11:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB