hi all
         i want to select random records from listing table using this
format,becoz i want to use
some method of listing class.

          $c=new Criteria();
           $c->addJoin(BuilderProjectPeer::OWNER_ID, OwnerPeer::ID);
           $c->addJoin(ListingPeer::OWNER_ID,
BuilderProjectPeer::OWNER_ID);
           $c->setLimit(5);
           $c->addAscendingOrderBy(rand());//line 47
           $checkrecord = ListingPeer::doSelectJoinOwner($c);

It is giving error

Fatal error: Call to undefined method Criteria::addAscendingOrderBy()
in /home/kusum/workspace/zam_fe/apps/frontend/modules/home/actions/
actions.class.php on line 47


how i can set rand() in order by.


Using this query it is working properly.

$query2 = "SELECT listing.ID as listingid,listing.covered_area as
covered_area ,listing.BEDS as listingbed,listing.PRICE as
listingprice,listing.CITY as listing_city,listing.AREA as
listing_area,listing.PROPERTY_TYPE as listing_property_type ,
builder_property.name as propertyname,owner.logo_url as
logo,listing.photo_url as photo FROM
listing,builder_property,builder_project,owner WHERE
listing.OWNER_ID=owner.ID AND
builder_project.OWNER_ID=listing.OWNER_ID  AND
builder_project.OWNER_ID=listing.OWNER_ID ORDER BY rand() LIMIT 4";
       $conn = Propel::getConnection();
      $stmt = $conn->prepareStatement($query2);
     $this->listingbuilder =$stmt->executeQuery();

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to