Captain Cree
asked on
PHP FreeTDS unable insert into MSSQL
I'm able to run select statements to my sql server
But I'm unable to run inserts into the DB. The user has write permission to the sql db. I've tried a lot of examples I've found on the net but with no success.
$link = mssql_connect('10.10.50.xxx', 'userx', 'pasx');
if (!$link)
die('Unable to connect!');
if (!mssql_select_db('Camstat', $link))
die('Unable to select database!');
$result = mssql_query("INSERT INTO [DB1].[dbo].[Footage_Age] ([DVRId] ,[CameraId] ,[Last_Date] ) VALUES (135456,525685,'2013-08-27')");
while ($row = mssql_fetch_array($result)) {
var_dump($row);
}
mssql_free_result($result);
But I'm unable to run inserts into the DB. The user has write permission to the sql db. I've tried a lot of examples I've found on the net but with no success.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You should simply be checking if the value was TRUE or FALSE.
Try something like the following:
Open in new window
Note that there should be no need to free the result, as your insert would not generate more than one result.