View Single Post
Old 09-14-2004, 08:22 PM   #5 (permalink)
imaginemn
v7n Mentor
 
imaginemn's Avatar
 
Join Date: 02-18-04
Location: Minneapolis, Minnesota
Posts: 1,947
iTrader: 0 / 0%
Latest Blog:
None

imaginemn is a name known to allimaginemn is a name known to allimaginemn is a name known to allimaginemn is a name known to allimaginemn is a name known to allimaginemn is a name known to allimaginemn is a name known to allimaginemn is a name known to allimaginemn is a name known to allimaginemn is a name known to allimaginemn is a name known to all
Send a message via MSN to imaginemn Send a message via Yahoo to imaginemn Send a message via Skype™ to imaginemn
This one is a little tough because I do not know if $actual_answer is a number or a string. If it's a string I would probably use the strcmp(str1, str2) command instead.

In reality there is nothing wrong with the code that was submitted. I guess we would need to see the rest of the code because the function does work. I added a print command to see what was being displayed and in this example the first output is 3 and the second is 4.

Code:
$actual_answer = "Don't know"; $answers[0] = "Yes"; $answers[1] = "No"; $answers[2] = "Don't know"; $results[0] = "2"; $results[1] = "7"; $results[2] = "3"; $set_num = 0; while ( $answers[$set_num] != "" ) { if ( $answers[$set_num] == $actual_answer ) { print $results[$set_num]; print "<BR>"; $results[$set_num]++; print $results[$set_num]; print "<BR>"; } $set_num++; } unset($set_num);
__________________
Need a project done? - Set Your Own Price!
Imagine Creative Services
- Design : Marketing : Multimedia : More
imaginemn is offline   Reply With Quote