Page 1 of 1

Help with array

Posted: Sat May 16, 2009 5:39 pm
by whizzfrapp
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));
  }

Re: Help with array

Posted: Sat May 16, 2009 5:42 pm
by Darhazer
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)));