DATE_FORMAT()mysql代码可以在PHPMyAdmin中运行,但不能在PHP中运行

I am writing a reporting method in PHP which is passed 2 parameters $location and $weekYear. $weekYear is a string that is formatted like 2015-W34, i.e. the 34rth week of 2015. the sql code I am trying to run looks like:

   $sql = "SELECT 
          CONCAT(tutor.first_name, ' ', tutor.last_name) AS Student,
          CONCAT(tutor.first_name, ' ', tutor.last_name) AS Tutor,
               hours as HoursWorked, 
               DATE_FORMAT(work_date, '%a - %b %d') AS Day,
               DATE_FORMAT(start_time, '%H') AS Hour, 
               DATE_FORMAT(start_time, '%i') AS Minute

          FROM timesheet_entry

          LEFT
          JOIN user
            AS student
            ON student.id = timesheet_entry.student_id

          LEFT
          JOIN user
            AS tutor
            ON tutor.id = timesheet_entry.tutor_id

         WHERE DATE_FORMAT(work_date,'%x-W%v') = '".$weekYear."'
           AND tutoring_location = '".$location."'
           AND work_type = 'instruction'
           AND (instruction_type = '1-on-1' OR instruction_type = 'group')";


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

When I run the code in php I get no results returned but when I echo out the $sql and then paste that into PhpMyAdmin I get the results I expect.

Furthermore if I remove the part

DATE_FORMAT(work_date,'%x-W%v') = '".$weekYear."'

the method runs, and returns more records than I want, but it runs nonetheless.

What about my DATE_FORMAT() is causing this query to malfunction?

Any help, advice, and suggestions are greatly appreciated!

i thing that you make a function for that mysql and php use your parameters $location and $weekYear because that your parameter WEEKYEAR is diferetn to the standar format and php or mysql dont function