Here is my code. The error message says the problem is in the while
loop statement.
Warning: sqlsrv_fetch_array() expects parameter 1 to be resource, null given in line 136
/* We need to create a connection to SQLServer08 */
$serverName = "**************\main, 1433";
$connectionOptions = array("Database"=>"****", "UID"=>"****","PWD"=>"****");
$conn = sqlsrv_connect( $serverName, $connectionOptions);
$EventID = $_GET['id'];
/* Excecute a Query */
$tsql = "SELECT *
,convert(int,LEFT(starttime,2)) as StartHour
,SUBSTRING(convert(varchar,StartTime),4,2) as StartMinute
,convert(int,LEFT(endtime,2)) as EndHour
,SUBSTRING(convert(varchar,EndTime),4,2) as EndMinute
FROM Event where EventID =". $EventID;
$stmt = sqlsrv_query( $conn, $tsql);
/* Retrieve and display the results of the query. This is an array-recordset, so we loop thru the results */
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
The weird part with all of this is that my code will still compile. Even when I change something from the client's perspective, it makes the change in the database and lists the new information. I just need the error to go away!
Thanks guys!