title: php countering in javascript doesn't work
body: <p>okay here is my code :</p>
  
  <pre><code>var co = 0;
  var comp = '';
  &lt;?php $i = 0;?&gt;
  while (co &lt; &lt;?php echo $db-&gt;count_rows(); ?&gt;)
  {
      if ((parseInt(value) &gt;= &lt;?php echo $mfr[$i] ?&gt;) &amp;&amp; (parseInt(value) &lt;= &lt;?php echo $mto[$i] ?&gt;))
      {
          comp = 'T';
          break;
      }
      co++;
      &lt;?php $i++; ?&gt;
  }
  </code></pre>
  
  <p>i'm still learning about this whole php and javascript thing, and i know there are many things that i still had to work to to improve my understanding to this both language. that's why i really need your help in this</p>
  
  <p>i'm trying to get the while iteration to work so i can compare the variable from javascript with variable from php which took the value from database. the php variable ('$mfr' and '$mto'), as you can see, is an array. now i want it to look at every element of both and if it meets the condition then it will update the variable 'comp' and stop the whole while iteration</p>
  
  <p>but the problem is the '$i' variable doesn't do the iteration thing. it runs only once so my '$mfr' and '$mto' value doesn't go anywhere. how can i fix this so i can compare the javascript value with the php '$mfr' and '$mto' value?</p>
  
  <p>your help would be much appreciated, thank you :)</p>
  
  <p>EDIT</p>
  
  <p>well, it is actually a function of custom validation for jqgrid.
  and i do know that php is a server-side and javascript is a client-side language theoretically, though i don't really know it is practically</p>
  
  <p>what i'm actually trying to do is when a user input a value and submit it, the system will check whether the value that was entered are between value of 'fromid' and 'toid' column of a table in database</p>
  
  <p>here is my full code of the function</p>
  
  <pre><code>function checkid(value)
  {
  var co = 0;
  var comp = '';
  &lt;?php $i = 0;?&gt;
  while (co &lt; &lt;?php echo $db-&gt;count_rows(); ?&gt;)
  {
      if ((parseInt(value) &gt;= &lt;?php echo $mfr[$i] ?&gt;) &amp;&amp; (parseInt(value) &lt;= &lt;?php echo $mto[$i] ?&gt;))
      {
          comp = 'T';
          break;
      }
      co++;
      &lt;?php echo $i++; ?&gt;
  }
  
  if (comp != 'T')
  {
      return [true, "", ""];
  }
  else
  {
      return [false, "Value entered is already between a range. Please try again!", ""];
  }
  }
  </code></pre>
  
  <p>while this is how i got the '$mfr' and '$mto' variable</p>
  
  <pre><code>&lt;?php
  $db=new database($dbtype, $dbhost, $database, $dbuser, $dbpassword, $port, $dsn);
  $db-&gt;query("select fromid, toid from CORE_ID");
  $i = 0;
  while($row = $db-&gt;get_row())
  {
  $mfr[$i] = $row[fromid];
  $mto[$i] = $row[toid];
  $i++;
  }
  ?&gt;
  </code></pre>
  
  <p>if theres any better way to do this, then please do tell me</p>