PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
whizzfrapp
Forum Newbie
Posts: 1 Joined: Sat May 16, 2009 5:38 pm
Post
by whizzfrapp » Sat May 16, 2009 5:39 pm
Is there any way to use the keys that i want in a keyed array?
I'm doing this but it gives me an error
Code: Select all
$result = db_query('SELECT * FROM {team}');
$rows = array();
while ($team = db_fetch_object($result)) {
array_push($rows, $team);
}
$check = array();
foreach($rows as $team)
{
$id = $team->team_id;
$name = $team->name;
array_push($check, $id => t($name));
}
Last edited by
Benjamin on Sat May 16, 2009 6:18 pm, edited 1 time in total.
Reason: Changed code type from text to php.
Darhazer
DevNet Resident
Posts: 1011 Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria
Post
by Darhazer » Sat May 16, 2009 5:42 pm
What error give you this?
And you have a function called 't' defined?
P.S.
The last line probably should be:
Code: Select all
array_push($check, array($id => t($name)));