Using the following simple code:
$aQuery = "INSERT into myTable (a, b, c) VALUES (1, 'Hello', 'Goodbye')";
$result = sqlsrv_query($myConn, $aQuery ); //where $myConn is valid and defined elsewhere
if (!$result) {
echo 'FAIL';
}
else {
echo 'It worked BABY!';
}
What is the value of $result if the query executes successfully, and how do I access the resource properly? echo $result; will print: Resource id #8.
When the query fails
$result == falseSo in your code:
Any value that is not
falseor0is consideredtrueAddendum based on comments below.
Only
SELECTreturns content.