PHP SQL Server Error Tracking

I track mysql errors using the mysql_error function that everyone knows. But I am mssql_ records from SQL Server, for this I used all the mssql_ functions provided by PHP.

One of my requests is not being executed, and I'm not sure where I made the mistake. Can someone tell me exactly which SQL Server function monitors database errors (available in PHP).

 SELECT * FROM gb WHERE postalcode like 'YO1%' OR place like 'YO1%' group by postalcode, region3 order by postalcode asc 
+4
source share
3 answers

Unfortunately, there is no error function in SQL Server. Use mssql_get_last_message() .

+6
source

This is a simple select sql. I would like to run this in SQL Server Management Studio if I were you. Also, try this link http://www.php.net/manual/en/function.mssql-get-last-message.php#21728 , where someone was trying to solve problems using the GENERIC ERROR HANDLING stored procedure.

+1
source
 SELECT * FROM gb WHERE postalcode like 'YO1%' OR place like 'YO1%' group by postalcode, region3 order by postalcode asc 

This may not work because you are using the GROUP BY clause. You will need to specify which fields to display. So something like:

 SELECT postalcode, region3 FROM gb WHERE postalcode LIKE 'YO1%' OR place LIKE 'YO1%' GROUP BY postalcode, region3 ORDER BY postalcode ASC 
0
source

All Articles