foreachloop going 8 times expected
Posted: Fri Sep 05, 2003 8:30 pm
from the mysql cli (the cof was made as it is because i was having issues with the adding page trying to update when nothing was there)from the table it prints out when echoedi don't understand what's wrong with the foreach loop that's causing that. $desired is an array of associative arrays. each associative array is the information on the friend of the user. i can't think of anything else that might help.
the section of code where i format this for displaymysql> select * from friends;
+-----+------+-----+-------------------+
| uid | fuid | fun | cof |
+-----+------+-----+-------------------+
| 1 | 1 | Neo | add damn you add! |
+-----+------+-----+-------------------+
1 row in set (0.99 sec)
mysql>
Code: Select all
foreach($desired as $friend){ # for each friend
$debug.='making desired'; // debug line
$fuid=$friend['fuid']; $frnd=$friend['fun']; $cof=$friend['cof']; # break up the info
$desires.=" <tr><td><input type="checkbox" name="delf[]" value="$fuid"></td><td><a href="profile.php?un=$frnd" onClick="alert('Your Comment on $frnd: $cof');" target="$frnd">$frnd</a></td></tr>\n"; # make the display
}
}the source of that1
1
1
1
N
N
a
a
Code: Select all
<tr><td><input type="checkbox" name="delfї]" value="1"></td><td><a href="profile.php?un=1" onClick="alert('Your Comment on 1: 1');" target="1">1 </td></tr>
<tr><td><input type="checkbox" name="delfї]" value="1"></td><td><a href="profile.php?un=1" onClick="alert('Your Comment on 1: 1');" target="1">1 </td></tr>
<tr><td><input type="checkbox" name="delfї]" value="1"></td><td><a href="profile.php?un=1" onClick="alert('Your Comment on 1: 1');" target="1">1 </td></tr>
<tr><td><input type="checkbox" name="delfї]" value="1"></td><td><a href="profile.php?un=1" onClick="alert('Your Comment on 1: 1');" target="1">1 </td></tr>
<tr><td><input type="checkbox" name="delfї]" value="N"></td><td><a href="profile.php?un=N" onClick="alert('Your Comment on N: N');" target="N">N </td></tr>
<tr><td><input type="checkbox" name="delfї]" value="N"></td><td><a href="profile.php?un=N" onClick="alert('Your Comment on N: N');" target="N">N </td></tr>
<tr><td><input type="checkbox" name="delfї]" value="a"></td><td><a href="profile.php?un=a" onClick="alert('Your Comment on a: a');" target="a">a </td></tr>
<tr><td><input type="checkbox" name="delfї]" value="a"></td><td><a href="profile.php?un=a" onClick="alert('Your Comment on a: a');" target="a">a </td></tr>