I am trying to use a PHP webpage to get data from MSSQL and get the error message shown in the Question Title.
This is my connection code:
$hostname = "MAIN";
$username = "sa";
$password = "";
$dbName = "NewSQL";
MSSQL_CONNECT($hostname,$username,$password) or DIE("DATABASE FAILED TO RESPOND.");
mssql_select_db($dbName) or DIE("Table unavailable");
$query = "SELECT * FROM Customer";
$result = mssql_query($query);
$numrows = mssql_num_rows($result);
I have found out the problem is down to 2 NTEXT fields in the MSSQL table I am trying to select from. I have found this solution:
mssql_query("SELECT CAST(field1 AS TEXT) AS field1 FROM table;");
Which would solve it - but I want to do a 'SELECT *'.
Can anyone provide me with a better solution or a way of rewriting my currently located solution to 'SELECT *' and simultaneously select the 2 NTEXT fields 'AS TEXT'?