views:

68

answers:

1

I make an AJAX GET request to a PHP script to compare a value in a textfield to one in a database on every character typed - this works smoothly and beautifully on my laptop (Windows).

I transfer my scripts to computer running windows server 2003 and it tries to make a GET request but it returns a "500 Internal Server Error"?!

What is going on? The PHP script is the following:

include('includes/db-connect.php');
$connectionInfo = array( 'Database' => 'TYn_Motor');
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if($conn){
    $tsql = "SELECT * FROM Monitor_User_Session WHERE Session_ID = '".$_GET['session_id']."'";
    $stmt = sqlsrv_query($conn, $tsql);
    if($stmt !== null) {
     if(sqlsrv_has_rows($stmt) === false){
      echo '0';   
     }else{
      echo '1';
     }
    }else{
     echo '1';
     //die( print_r( sqlsrv_errors(), true));
    }
}else{
       echo '1';
     //echo 'Database Connection could not be Established';  
}
sqlsrv_close($conn);

Can anyone see what could be causing the problem?

The includes is just one line - the variable $serverName is set. I am running PHP 5.3.0 on my laptop, the server is running PHP 5.2.9.

+5  A: 

If the production server has display_errors set to off, then it's possible that a regular PHP error is thrown (e.g. an extension is missing), but nothing is displayed. Try placing ini_set('display_errors', true) at the very beginning of your script.

Ignas R
Thank you. Should of done that first. For a strange reason, I get sqlsrv_has_rows is an undefined function even though the sql server driver is installed and other sql server calls work - but thats another question for stackoverflow, if I can't figure it out! :)
Abs