Use wpdb
$mydata = $wpdb->get_results($wpdb->prepare("SELECT * FROM mydatatable"));
echo "<pre>"; print_r($mydata); echo "</pre>"; //just to see everything
Thread Starter
shadd
(@shadd)
Thanks. Ok, I have just realised another problem which I dont know how to fix. The initial idea was to have 3 tables (user_courses, user_events, user_news) – I want a different page for each table. So for example:
page?id=1 will load all the courses table blogs/comments
page?id=2 will load all the event table blogs/comments
and so on..
Is this possible in WP ?
Create a page template (then attach that Template when edit/writing a page) and in that page template use wpdb to get the data. Of course you’d need three pages and three templates (or code one template to handle the three conditions).
Thread Starter
shadd
(@shadd)
Thanks MichaelH, I will try it out and see how it goes. BTW, is there any encapulsation involved ? I come from a Java background and mixing model/view/controller logic is bad practise for the simple reason that it makes it a nightmare to manage/maintain.
Not really. You will want to understand Template Hierarchy and Stepping Into Templates to make use of theme template files.
Thread Starter
shadd
(@shadd)
Thanks. Ok, considering the complexity of the project do you think it would be better to just use a framework like codeignitor and build from that ? WP would be good for one blog but three at once looks like quite a challenge.
It’s hard to say–three custom tables doesn’t seem to be too much to handle but your concerns about ‘bad practise’ may lead you in a different direction.
Thread Starter
shadd
(@shadd)
Ok – The three tables will have comments, so I may have to mod the existing table or create a new one.
BTW, do you know whether I can get rid of ‘posts’, ‘media’, ‘links’ menus/features from the admin CP ?