RE: [PHP] Help!!! DB field data is truncated!!!!!

From: Date: Wed, 26 Jul 2000 23:40:36 +0000
Subject: RE: [PHP] Help!!! DB field data is truncated!!!!!
Groups: php.general 
Request: Send a blank email to php-general+get-8440@lists.php.net to get a copy of this message
I can successfully INSERT into the table via PHP; but when I SELECT the same data from the table, PHP returns only half of it (it gets truncated). I can manually open the table to determine that all of the data made it into the table OK. PHP is ACTING as if the variable has a LIMIT to the amount of text it can hold (probably not true, but it seems that way)! Again, I repeat, ALL of the data is in the table (I can copy and paste it into notepad)! So the field type must be OK (I changed it to text from varchar). Thanks for you help. Any suggestions from the list would be helpful! Here is my code: --------------------------------------------- $db_link=mssql_connect("mamadb","",""); mssql_select_db("[Job Bank]",$db_link); $db_query="SELECT text "; $db_query.="FROM departments "; $db_query.="WHERE [Department Name]='$mydept'"; $db_result = mssql_query($db_query, $db_link) OR die("An error occurred in the execution of the SELECT SQL command."); **** $db_row = mssql_fetch_row($db_result); **** $output=$db_row[0]; // here is the output variable; it doesn't contain all of the data from the selected field $writeFile="myfile.txt"; $fileHandle=fopen($writeFile, "w+"); if(!$fileHandle) { print("<P>The file could not be opened!</P>"); exit; } else { **** print("<P>$output</P>"); // here is the output variable; it doesn't contain all of the data from the selected field } fputs($fileHandle, $output); fclose($fileHandle); ------------------------------------------ Thanks. -zb -----Original Message----- From: John Coggeshall [mailto:someone@internetaddress.com] Sent: Wednesday, July 26, 2000 3:38 PM To: Zack Beatty; php-general@lists.php.net Subject: RE: [PHP] Help!!! DB field data is truncated!!!!! I thought VARCHAR was limited to 255 characters.... try changing the field type to TEXT and see if that fixes the problem. John -----Original Message----- From: Zack Beatty [mailto:ZackB@mamamedia.com] Sent: Tuesday, July 25, 2000 10:38 PM To: 'php-general@lists.php.net ' Subject: [PHP] Help!!! DB field data is truncated!!!!! Any information that I pull from my SQL Server database get cut off after a certain number of characters. It is a field of type "varchar" with the maximum length of 8000. When I get the field data, only half of the paragraph is outputted by PHP. When I manually go into the database, I can copy the entire row (and paste it into notepad) to determine that the data is successfully in the database. It just gets "chopped off" before being displayed as HTML. Any suggestions would be appreciated. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#8440) next »