OxWall How to Query using “WHERE” clause
OK, so in the OxWall Developer Plugin Crash Course it’s pretty easy to get how you can query a table and get the result based on a particular ID. What if you want to get the results where a particular column say “user_id” = 2 in table “user_entries”?
Well, it’s not quite as well documented, so here’s how I did it and I think it is correct.
If you are not familiar with how to create the service.php, uniquename.php and uniquename_dao.php files used to get data and pass data from the DB, then check out the link I provided earlier.
Ok so here it is. This would go inside your service.php file for your plugin:
public function getUserEntriesByUserId($id){
$ex = new OW_Example();
$ex = andFieldEqual(‘user_id’, $id);
return YOURPLUGINNAME_BOL_EntriesDao::getInstance()->findListByExample($ex);
}
Thank you,
Charles Benson, http://OxwallAccessories.com
Looking for quality OxWall Hosting? Look no further than Arvixe Web Hosting!
– See more here