Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
SQL query error with WEEK() mysql function
  • As the title suggest I have a problem using WEEK() sql method
    Here's the error message
    ErrorException [ Error ]: Call to undefined function WEEK()
    and here's my code which fire the error DB::select()
    ->from($table)
    ->where_open()
    ->where(DB::expr(WEEK('created_at')), DB::expr(WEEK(CURRENT_DATE)))
    ->and_where('language', $lang)
    ->where_close()
    ->execute()->as_array();
  • thanks again Harro
  • This way week() is seen as a php function. It should be
    ->where(DB::expr("WEEK('created_at')"), DB::expr("WEEK(CURRENT_DATE)"))
    

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion