Search code examples
phpsqlpropel

Multiple parameters in where clause


I need to append multiple parameters for where clause. Is there any way to achieve that using Propel. It gives me,

Criteria:(Error: Could not build SQL for expression "LATITUDE" because Criteria::RAW works only with a clause containing a single question mark placeholder)

This is my query.

$userArray = UserQuery::create()
  ->where('( 3959 * acos( cos( radians(?) )
    * cos( radians( User.latitude ) )
    * cos( radians( User.longitude ) - radians(?) )
    + sin( radians(?) )
    * sin( radians( User.latitude) ) ) ) > 10', 
    $user->getLatitude(),
    $user->getLongitude(),
    $user->getLatitude()
  )->find();

Solution

  • Did you try passing array as a first parameter to the where method? :)