Welcome Guest, Not a member yet? Register   Sign In
Active record select problem
#1

[eluser]mejlo[/eluser]
Hi,
Code:
->select('DATE_FORMAT(FROM_UNIXTIME(created_at), "%e.%b.%Y") as created', FALSE)
and result is
Code:
[created] => 30.nic_Oct.2012
this problem occurs only when there is table prefix in database configuration ("nic_")
#2

[eluser]clive_turner[/eluser]
Had similar problems with CONCAT and Date_Format. The issue is the commas in SELECT clauses. Active Record explodes the SELECT clause using "," as a delimiter, to turn the string into an array of fields. While this works with simple select statements like col1, col2, col 3, it produces strange results with any SELECT statement that contains a comma eg CONCAT and DATE_FORMAT.

The solution is to enter the SELECT fields as an array and not as a string, so it bypasses the explode function.

ie
Code:
$select=array("CONCAT( HouseNo, ',  ' , Address1 ) AS Property",
         "property.PropertyId");
  
  $this->db->select($select);

#3

[eluser]mejlo[/eluser]
Works Smile
Thx.




Theme © iAndrew 2016 - Forum software by © MyBB