How to Query by Using “WHERE” Clause in Oxwall

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

Tags: , , , , , , , | Posted under Oxwall | RSS 2.0

Author Spotlight

Charles Benson

Charles Benson

I'm here to find you answers and give you tips on running an oxwall based website through Arvixe Web hosting. If you need anything at all feel free to get in touch with me!

Leave a Reply

Your email address will not be published. Required fields are marked *


5 + = 14

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>