|
GamingG@firefoxowns.com - 24 Jul 2008
I believe Gayatri was writing the array in PHP syntax, but intended for the information to be retrieved from the database. I was just working on something similar, so here's my code, in case it helps:
$forumq = $g_mysql->query("SELECT * FROM `forums` WHERE `is_category`=0 ORDER BY `forder`");
$allforuma = array();
while($a = $g_mysql->fetch_array($forumq))
{
if(!array_key_exists($a['parent_id'], $allforuma))
{
$allforuma[$a['parent_id']] = array();
}
$allforuma[$a['parent_id']][] = $a;
}
A PHP User - 24 Jul 2008
Check out http://www.php.net/manual/en/function.ksort.php or http://www.php.net/manual/en/function.sort.php.
popey - 24 Jul 2008
To use Gayatri’s array would be to complicated for php in imagine the list having 200 sets of data. The way around this using php would be to use mysql and simply make query
popey - 24 Jul 2008
To use Gayatri’s array would be to complicated for php in imagine the list having 200 sets of data. The way around this using php would be to use mysql and simply make query
A PHP User - 24 Jul 2008
test
A PHP User - 24 Jul 2008
test
A PHP User - 24 Jul 2008
I am not sure if this is the right place to ask for help...I didn't find an exclusive link to do do so....
I have an array like this:
$arr[0][FirstName] = "Jack";
$arr[0][Email] = "jack@yahoo.com";
$arr[0][city] = "Australia";
$arr[1][FirstName] = "Adam";
$arr[1][Email] = "adam@yahoo.com";
$arr[1][city] = "South Africa";
$arr[2][FirstName] = "Eve";
$arr[2][Email] = "eve@yahoo.com";
$arr[2][city] = "Japan";
I would like to sort this array based on FirstName or Email or City...is there are built in function in PHP to do so?
Please help!
Regards Gayatri
chrizPadilay - 24 Jul 2008
Dude in English pls?
chrizPadilay - 24 Jul 2008
Dude in English pls?
A PHP User - 24 Jul 2008
umop apisdn asuasuou se swaas
A PHP User - 24 Jul 2008
iuouoiuoiu oi uoiupo u12
A PHP User - 24 Jul 2008
iuouoiuoiu oi uoiupo u12
Add comment
Please note that by posting a comment here you are committing it to the public domain. This is important so that others can make use of your code themselves, and also so that I can incorporate helpful notes directly into the main text. Comments are limited to 2000 characters in length.
If you are reporting an error in the content, please tell me directly.
|