Trouble with mssql_fetch_array

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
chewbacka
Forum Newbie
Posts: 1
Joined: Tue Jun 21, 2005 2:59 pm
Contact:

Trouble with mssql_fetch_array

Post by chewbacka »

Can anyone please help me. I'm developing a CRM. Frontend is PHP and backend has to be MSSQL(bosses order). I have a Comments field, varchar(5000). When I use mssql_fetch_array and print out the Comments field only part of the field is returned. Is there a limit on the length you can return in the mssql_fetch_array()?
method_man
Forum Contributor
Posts: 257
Joined: Sat Mar 19, 2005 1:38 am

Post by method_man »

i read this in a comment on http://www.php.net

"If you're having problems trying to get data stored in a varchar column with more than 255 chars use CONVERT to change the data type to TEXT like this:

$query=mssql_query("SELECT table.id, CONVERT(TEXT, table.comment) AS comment FROM table");

Don't forget to set name for the column (AS comment) or you won't be able to retrieve the data ..."

hope that helps :D

btw here is the exact url i got it from http://us4.php.net/function.mssql-query
Post Reply