Hi, I'm new to PHP. Is there a way to add a key/value pair to an associative array?
I'm tryint to do this, but it dosn't work.
$result = array();
while ($row = mysql_fetch_array($result)) {
array_push($result, $row[login], $row[name]);
}
What is the resultant array that you expect? In other words, what are the keys and what are the values?
Maybe you just want to do this?
while ($row = mysql_fetch_assoc($result)) { $result[$row['login']] = $row['name']; }
Thank you for your help. It's solved with your advise.