Warning: mssql_query () [function. mssql-query]: Queryfailedin SQL can be correctly executed in the database, but an error is returned when it is executed in php:
Warning: mssql_query () [function. mssql-query]: Query failed in...
Warning: mssql_fetch_array (): supplied argument is not a valid ms SQL-result resource in...
The error line is as follows:
$query = mssql_query($sql);while($row=mssql_fetch_array($query)){
The SQL statement will not be pasted out for a long time, but it is absolutely correct. After I output the SQL statement using echo, it will be correctly executed in the database. How can I solve the above problems?
Reply to discussion (solution)
Warning: mssql_query () [function. mssql-query]: Query failed in...
Query failed!
Warning: mssql_query () [function. mssql-query]: Query failed in...
Query failed!
However, the SQL statement is correct and I am sure it is correct. Why does the query fail?
How can I know it is correct?
If the SQL statement is correct, the wrong database may be selected.
Besides, what you see is not necessarily the truth.
I also encountered this problem.
I also encountered this problem.
Try writing SQL statements in other equivalent forms, for example, changing = 'xx' to in ('XX ')