• Resolved robthirlby

    (@robthirlby)


    I suspect this is my failure to understand quoting in php but I am trying to get a single instance of a pod using a where clause.
    Some help would be much appreciated.
    If I do

    $params=array('limit' => 15,  'where' => 't.user_login = "lisa"');
    $obj=pods('user',$params);

    I get the required result.

    If I do

    $params=array('limit' => 15,  'where' => 't.user_login = $username');
    $obj=pods('user',$params);

    I get an sql error Response: Unknown column ‘$username’ in ‘where clause’

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try this once.

    $params=array("limit" => 15,  "where" => "t.user_login = $username");
    $obj=pods("user",$params);

    Try:

    $obj = pods( 'user', $username );

    Lookups for users are by ID or by user_login.

    Also, a good note here is that in your $params example above, you used $username but did not quote it like "$username" which would cause a MySQL error.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘pods() parameter where clause’ is closed to new replies.