salman_ahad@yahoo.com Posted November 2, 2009 Share Posted November 2, 2009 What is my error?...I need to send message[$x] to user[$w]...but is is not working ... $userArray['username'][$w]=$row['usernm']; //getting users from user table $messageArray['message'][$x]=$row['message']; //getting messages from message table ... for($i=0 ; $i<$userCounter ; $i++) //I checked the counter, it has correct no: of users { while ($w==$x) { $username=$userArray['username'][$w]; $message=$messageArray['message'][$x]; if(strlen($message)<1) { echo $error; } else { ................ ................ } } } Quote Link to comment https://forums.phpfreaks.com/topic/179922-solved-for-or-while-loop/ Share on other sites More sharing options...
mikesta707 Posted November 2, 2009 Share Posted November 2, 2009 you need to post the code you left it, because $w==$x doesn't make any sense. From what i have seen, you don't update either variable, and if they are not equal that loop will never run, and if they are equal the loop will be infinite Quote Link to comment https://forums.phpfreaks.com/topic/179922-solved-for-or-while-loop/#findComment-949140 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.