I am in need of incrementing through a php array with the javascript variable "i" instead of where i have 0 in the $members array call

var i = 0;
    while (i<5)
      {
        if (<?php echo json_encode($members[0]['department']); ?> ==  "CHE"){
                contacts.push({"NAME":"Sir Saula","TITLE":"John","CONTACT":"bab","RESEARCH":"Ph.D."});      
        }
      i++;

      }

i doubt you can do it straightaway.. coz javascript wont be executed server side.. so while your php code is getting interpreted at server level you can't increment a javscript variable..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.