Welcome Guest, Not a member yet? Register   Sign In
MySQL DATE_FORMAT
#2

[eluser]borgir[/eluser]
This happens when the DB_active_rec.php tries to compile your SELECTed fields (_compile_select method).
It runs the _protect_identifiers method foreach of the selected columns.
However, your select statement is a function, not column(s) so the statement is exploded by commas.
Code:
[0] => date_format(checkout_date
[1] => '%d.%m.%Y') as created_date
and the _protect_identifiers method, expecting something like this:
Code:
SELECT * FROM hostname.database.table.column AS c FROM hostname.database.table
Or a query with aliasing:
SELECT m.member_id, m.member_name FROM members AS m
adds your table prefix thinking that is "compiling" something like this m.member_id here (DB_driver.php file):
Code:
// We only add the table prefix if it does not already exist
if (substr($parts[$i], 0, strlen($this->dbprefix)) != $this->dbprefix)
{
$parts[$i] = $this->dbprefix.$parts[$i];
}

For now I suggest that you use this syntax:
Code:
$res = $this->db->query( "SELECT date_format(created, '%d.%m.%Y') as created_date FROM slticket");


Messages In This Thread
MySQL DATE_FORMAT - by El Forum - 07-10-2012, 02:40 AM
MySQL DATE_FORMAT - by El Forum - 07-10-2012, 06:39 AM
MySQL DATE_FORMAT - by El Forum - 07-11-2012, 02:38 AM
MySQL DATE_FORMAT - by El Forum - 08-19-2012, 02:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB