PHP Change Array Over and Over
Posted
by Steven
on Stack Overflow
See other posts from Stack Overflow
or by Steven
Published on 2010-05-21T08:02:34Z
Indexed on
2010/05/21
8:10 UTC
Read the original article
Hit count: 241
php
Hello,
I have any array
$num_list = array(42=>'0',44=>'0',46=>'0',48=>'0',50=>'0',52=>'0',54=>'0',56=>'0',58=>'0',60=>'0');
and I want to change specific values as I go through a loop
while(list($pq, $oin) = mysql_fetch_row($result2)) {
$num_list[$oin] = $pq;
}
So I want to change like 58 to 403 rather then 0.
However I always end up getting just the last change and non of the earlier ones. So it always ends up being something like 0,0,0,0,0,0,0,0,0,403 rather then 14,19,0,24,603,249,0,0,0,403
How can I do this so it doesn't overwrite it?
Thanks
© Stack Overflow or respective owner