I'm using mssql_query("UPDATE...") to update my database.
However, this change only is read by a SELECT inside my script, at the same session....
If I run my script again only with the SELECT part, my data stays there, the same... unchanged. I've checked with SQL Profiler and my instructons were there... no errors, no commit, no rollbacks.
Otherwise, if I use odbc_exec... that works fine.
Any ideas?
I'm using (for test purposes) Windows 98 / Apache 1.3.14 / PHP
4.3.1 / SQL SERVER 7.0
See my script:
<?php
$myServer = "localhost";
$myUser = "sa";
$myPass = "";
$myDB = "Northwind";
$s = @mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
$d = @mssql_select_db($myDB, $s)
or die("Couldn't open database $myDB");
// try uncoment this line next run this script:
$result = mssql_query("UPDATE Employees SET FirstName = 'Glenda' WHERE FirstName = 'Laura'");
echo mssql_get_last_message();
$query = "SELECT TitleOfCourtesy+' '+FirstName+' '+LastName AS Employee ";
$query .= "FROM Employees ";
$query .= "WHERE Country='USA' AND Left(HomePhone, 5) = '(206)'";
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
while($row = mssql_fetch_array($result))
{
echo "<li>" . $row["Employee"] . "</li>";
}
?>