0

the following query is not working for me in PHP, I need help finding out what is wrong with it, I have check other examples and still don't know how to fix it...

$query = array(
    "Client"        => $notificationJob['Client'],
    "Email"         => $notificationJob['Email'],
    "Backup Type"   => $notificationJob['Backup Type'],
    array ( "$and"  => 
        array(
            array( "Message Subject" => new MongoRegex('/'. preg_quote($notificationJob['MessageSubject string1']). '/i') ),
            array( "Message Subject" => new MongoRegex('/'. preg_quote($notificationJob['MessageSubject string2']). '/i') )
        )
    ),

    "Time Stamp"    => array('$lte'=>New Mongodate($startDate->getTimestamp()))
);

The error I am getting is:

Notice: Undefined variable: and in ...

thank you very much

1 Answer 1

2

Use '$and'. Variables in double-quotes are interpolated.

You could also use "\$and"

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.