0

I am receiving the above error when trying to insert into a SQL Server DB. The error is line 25, which is the $logQuery line but I am pretty sure that it has something to do with the insert statement, which is line 24. Here is the insert statement:

$logInsert = "INSERT into log (id, title, description, dateTime) VALUES ('', 'In', 'ADMIN: Todd Thelin logged into site.', GETDATE())";

And here is the query:

$logQuery = sqlsrv_query($conn, $logInsert) or die("Could not add to log: " . sqlsrv_errors());

How do I fix this error? I have tried multiple things but none of them are working. Thank you

2 Answers 2

2

I believe sqlsrv_errors() is returning an array. That makes the die function to fail.

Sign up to request clarification or add additional context in comments.

Comments

1

Old thread but it helped me realize the following solution for this... wrapping print_r() around the sqlsrv_errors() function:

$logQuery = sqlsrv_query($conn, $logInsert) or die("Could not add to log: " . print_r(sqlsrv_errors()));

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.