www.webdeveloper.com
Results 1 to 2 of 2

Thread: PHP variable not incrementing

  1. #1
    Join Date
    Jun 2012
    Posts
    18

    PHP variable not incrementing

    my variable xt keeps on setting to 20 for all the javascript arrays why is it not incrementing after it stores into the array? Please help thanks!

    PHP Code:
    <? $xt 0 ?>;
        var j = 0;
    while (j < 200) {
     <?
      
    while(  $xt 250)
            {            
                if (
    $members[$xt]['department'] == $depttts){
                
                    break;            
                
                }        
                
                else {
                 
    $xt++;
                }
                
            }
             
            
    ?>
            
    contacts[j] = {"NAME": "<? 
        
    print $xt ?>","TITLE":"number: " + j + " ","CONTACT":"<? print ($members[$xt]['title']).'<br> <b>P: </b>'.($members[$xt]['phone']).'<br> <b>F: </b>'.($members[$xt]['fax']) ?>"}
    <? $xt++ ?>;


    j++;
    }

  2. #2
    Join Date
    Aug 2007
    Posts
    3,767
    Because you are printing it out after the loop terminates, it actually goes from 0 to 20 and then exits, and then prints out.
    Great wit and madness are near allied, and fine a line their bounds divide.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles