maliary Posted June 29, 2007 Share Posted June 29, 2007 Hi guys, It seems array issues just never end. I have this while loop below which displays data from a table. These are elements with this array $tp['name'] Inside the while loop is a counter variable which increments at every loop. This is used to display the elements from the $rval array. $rval array values have this '-' (hyphen). There is an if statement to remove these array elements, which it does apart from the very first array value $rval [0]. It never get removed. Why??? $tests = $db->Execute("SELECT * FROM care_test_param WHERE group_id ='$param_gp'"); while($tp = $tests->FetchRow()){ if ($rval[$counterup] != '-') { <tr class='; if($toggle) { $cache .= '"wardlistrow1"';}else { $cache .= '"wardlistrow2"';} > <td> echo '.$tp['name'].' </td>'."\n" <td> echo '.$tp['msr_unit'].' </td>'."\n" <td> echo '.$tp['lo_bound'].'</td>'."\n" <td> echo '.$rval[$counterup].' </td>'."\n" </tr> $toggle=!$toggle; } $counterup++; } Link to comment https://forums.phpfreaks.com/topic/57726-solved-array-issues/ Share on other sites More sharing options...
maliary Posted June 29, 2007 Author Share Posted June 29, 2007 I changed the first value of the array $rval to 2 ,previously it was -. Then I changed the if statement to if ($rval != 2) and it worked fine. Is there a problem of if statements and strings? Link to comment https://forums.phpfreaks.com/topic/57726-solved-array-issues/#findComment-285810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.