Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2009
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    for or while loop

    What is my error?...I need to send message[$x] to user[$w]...but is is not working

    PHP Code:
    ...
    $userArray['username'][$w]=$row['usernm'];    //getting users from user table
    $messageArray['message'][$x]=$row['message'];           //getting messages from message table
    ...
    for(
    $i=$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 
                {
                             ................
                             ................
                     }
            }
        } 

  • #2
    New Coder
    Join Date
    Nov 2009
    Location
    Australia
    Posts
    78
    Thanks
    0
    Thanked 7 Times in 7 Posts
    what is your error message?

    and what are the values of $w and $x ? is your $userCounter variable set? probably easier to debug if you post the whole code


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •