0

I got a query including two variable parameters. It cannot be executed successfully. Anyone help me to have a look. thanks

$queryUpdateScreeningMaileddate = "UPDATE screening
     SET maileddate = {date('Y-m-d', strtotime($mailed_date[$screeningId]))}
      WHERE user_id IN (  
                     select s.id
                     from (
                         SELECT users.id
                         FROM users
                         INNER JOIN screening ON 
                         users.id = screening .user_id
                         AND screening.id = {$screeningId}
                          ) as s)
       AND date BETWEEN '2011-05-15' AND '2011-11-15'";

   $_db->executeQuery($queryUpdateScreeningMaileddate); 
2
  • What templating engine is this? Commented Sep 13, 2011 at 14:24
  • Maybe you want to use "... SET maileddate = ".date('Y-m-d', strtotime($mailed_date[$screeningId]))."..." ? Commented Sep 13, 2011 at 14:28

1 Answer 1

2

Curly brace {} syntax only works for variables, it doesn't work for function calls. You will have to break the string up like this:

$queryUpdateScreeningMaileddate = "UPDATE screening
     SET maileddate = '".date('Y-m-d', strtotime($mailed_date[$screeningId]))."'
      WHERE user_id IN (  
                     select s.id
                     from (
                         SELECT users.id
                         FROM users
                         INNER JOIN screening ON 
                         users.id = screening .user_id
                         AND screening.id = {$screeningId}
                          ) as s)
       AND date BETWEEN '2011-05-15' AND '2011-11-15'";

   $_db->executeQuery($queryUpdateScreeningMaileddate); 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.