Hello. I am just trying to sort an array alphabetically. Here's the code I'm using:
function GetAssocCharities($registrationNo)
{
$db = ConnectionString::ConnectTo_www_ago_mo_gov_data();
$sqlstring = "SELECT * FROM charityPartners where RegistrationNo LIKE '$registrationNo' ORDER BY Name";
$results = @mysql_query($sqlstring);
$org = null;
while ($resultArray = mysql_fetch_array($results))
{
$temp = new Registrants($resultArray['ARegNoFormatted'], $resultArray);
$org[] = $temp;
}
return asort($org);
}
When I try to loop through the array using a foreach loop, I get an error that Invalid argument supplied for foreach().
Here's my foreach loop:
$lstCharities = OrgQueries::GetAssocCharities($registrant->RegNoFormatted);
foreach($lstCharities as $c)
{
//dom something here
}
I'm sure its something with not understanding list v array or something or that nature, but I'm not having much luck figuring it out with google.
Thanks!