title: php require and javascript
body: <p>I use this code to connect to a database:</p>
  
  <pre><code>@mysql_connect("localhost","root","") or die(mysql_error());
  @mysql_select_db("ECOLE") or die (mysql_error());
  @mysql_set_charset('utf8');
  
  if(isset($_POST['profname_in'])){
     $querycheck = "SELECT prof_som FROM prof_table 
                    WHERE prof_som=$_POST[profsom_in];";
     $_querycheck=mysql_fetch_array(mysql_query($querycheck));
     if(isset($_querycheck['prof_som'])){
       echo "0";
     }else{
       $query="INSERT INTO prof_table 
               VALUES('$_POST[profname_in]',
                      '$_POST[profcin_in]',
                      '$_POST[profsom_in]',
                      '$_POST[profville_in]',
                      '$_POST[profecole_in]',
                      '$_POST[profmat_in]',
                      '$_POST[profpass_in]');";
       if(mysql_query($query)){
             echo "1";
           }
     }
  }
  </code></pre>
  
  <p>the echos is recupered by a javascript function (ajax):</p>
  
  <pre><code>function adding_prof_Reply() {
  
  if(http.readyState == 4){ 
          var response = http.responseText;
  
       if(response==0){
              document.getElementById('prof_validation').innerHTML = '&lt;font color="red"&gt;'+response+'&lt;/font&gt;';
          }else if (response==1){
              document.location.href="dir_paneau.php";        
          }else{
              document.getElementById('prof_validation').innerHTML = '&lt;font color="red"&gt;'+response+'&lt;/font&gt;';
          }
  }
  }
  </code></pre>
  
  <p>everything works good, the problem is when I use <code>require('anyfile')</code> in the php code then the test <code>if(response==0)</code> is always false even when respose==0 ; if I remove the line of <code>require</code> everything works as it should.
  I need the require to not repeat the connection information, any ideas?</p>