Combining Output from 2 mysql_select Calls?
Hello, All -
Is it possible to combine the output from 2 mysql_select calls?
I am trying to create a drop-down select menu which would allow people to create a link to a page (category) or record. I need to grab the results from both tables and present them as one list.
I can do this in the backend using mySQL.
SELECT CONCAT('./', permalink) AS URL, CONCAT(name,' (Page)') AS LINK from cms_pages
SELECT CONCAT('?rec=', num) AS URL, CONCAT(name,' (Record)') AS LINK from cms_records
ORDER BY LINK
However, on a normal page it is proving more troublesome!
What were the problems when you tried to do it on a normal page?
PHP Programmer - interactivetools.com
Hi, Daryl -
I'm using this code on the a normal (front-end) page:
$allRecords = mysql_select('records'," hidden != '1' ");
$allPages = mysql_select('pages'," hidden != '1' ");
$result = array_merge_recursive($allRecords, $allPages);
It works - but my guess is it's a bit heavy.
Also, I would like to sort the $result alphabetically. The only snag is that records have "titles" and pages have "names"!