[dbscript-devel] customizing controller functions with specific queries
Status: Alpha
Brought to you by:
foghorn43
From: Kevin H. <kev...@ma...> - 2008-09-24 23:28:08
|
I hope this helps someone with a similar need. I was populating a drop down list in a template with content from a table called "usapages," but wanted to have a more specific query that would limit the data grabbed from this table. I was using the following line in my _new function in the controller: $page_id_options = $db->distinct_values( "usapages", "link" ); but I wanted to limit the values from the "usapages" table by using a custom MySQL query. So I replaced the above line with this: $page_id_options_x = mysql_query("SELECT page_id,menu_title from usapages WHERE level='1' and visibility='public'"); while ($result=mysql_fetch_array($page_id_options_x, MYSQL_NUM)) { $page_id_options[$result[0]] = $result[1]; } -- Kevin Hendrickson Wizard Webcoders, LLC Voice: 503-481-7125 Fax: 503-288-3144 http://www.wizardwebcoders.com |