I am getting two sets of data:
Code: Select all
$query = "SELECT `id`, `category`, `recom_cat`, `headline` FROM `canned` ORDER BY `category`, `id`";Code: Select all
$query = "SELECT `id`, `category`, `recom_cat`, `headline` FROM `custom` ORDER BY `category`, `id`";Code: Select all
$textDB[$row["category"]][] = array($row["recom_cat"], $row["headline"], "XXXX", $row["id"]);Essentially what I end up with is the $textDB multi-dimensional array with the results from the first query, then the results from the second query. I need to sort the $textDB array, within each first-level index ($row["category"]) AND THEN by the first field within each array ($row["recom_cat"]).
So for example, I might end up with this originally:
Code: Select all
$textDB["cat1"] = array("1", "Testing", "Canned", 512)
$textDB["cat1"] = array("2", "Testing", "Canned", 513)
$textDB["cat1"] = array("4", "Testing", "Canned", 514)
$textDB["cat1"] = array("9", "Testing", "Canned", 515)
$textDB["cat1"] = array("3", "Testing", "Custom", 214)
$textDB["cat1"] = array("5", "Testing", "Custom", 215)
$textDB["cat1"] = array("8", "Testing", "Custom", 216)
$textDB["cat2"] = array("1", "Testing", "Canned", 512)
$textDB["cat2"] = array("2", "Testing", "Canned", 513)
(etc)Code: Select all
$textDB["cat1"] = array("1", "Testing", "Canned", 512)
$textDB["cat1"] = array("2", "Testing", "Canned", 513)
$textDB["cat1"] = array("3", "Testing", "Custom", 214)
$textDB["cat1"] = array("4", "Testing", "Canned", 514)
$textDB["cat1"] = array("5", "Testing", "Custom", 215)
$textDB["cat1"] = array("8", "Testing", "Custom", 216)
$textDB["cat1"] = array("9", "Testing", "Canned", 515)
$textDB["cat2"] = array("1", "Testing", "Canned", 512)
$textDB["cat2"] = array("2", "Testing", "Canned", 513)
(etc)Any suggestions would be greatly appreciated! (Maybe there's a way to directly do this in SQL??)
Thanks!
PS. I'm running PHP 4.3.2 and mySQL 3.23.58.