Connecting Tech Pros Worldwide Help | Site Map

Strore large texts in mssql and dispaying them in php

mikek12004's Avatar
Familiar Sight
 
Join Date: Sep 2008
Location: Athens, Greece
Posts: 186
#1: Oct 3 '08
I have a text field where I wish to enter a large text around 8000 words and a div where I want to diplay it.
To save I have a textarea with post I gaet the text and save it using a simple
Expand|Select|Wrap|Line Numbers
  1. insert into clroot.descriptions (desc) values ('$text')
  2.  
$test is the PHP variable holding the text.
Storing is OK but when displaying It cuts me also some chahracters I use
Expand|Select|Wrap|Line Numbers
  1. select CONVERT(TEXT,descr1) from clroot.descriptions where id='1.00930'
  2.  
to show the data but the data in the table is e.g. 6332 chars and I see only the 4086 chars
ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,925
#2: Oct 3 '08

re: Strore large texts in mssql and dispaying them in php


What's the structure of your table? Can you increase the size of your column?

-- CK
mikek12004's Avatar
Familiar Sight
 
Join Date: Sep 2008
Location: Athens, Greece
Posts: 186
#3: Oct 3 '08

re: Strore large texts in mssql and dispaying them in php


id varchar(50)
desc1 varchar(8000)
desc2 varchar(8000)
desc3 varchar(8000)

in this table I want to store/display the biggest text possible what should I put to the column type? And will I have problems displaying in php?
mikek12004's Avatar
Familiar Sight
 
Join Date: Sep 2008
Location: Athens, Greece
Posts: 186
#4: Oct 3 '08

re: Strore large texts in mssql and dispaying them in php


I indded have a problem displaying them in PHP, when I use
Expand|Select|Wrap|Line Numbers
  1. $ree=mssql_query("select descr1 from clroot.descriptions where id='1.00930'");
  2. echo $ree[0];
  3.  
even though the descr1 is a column with TEXT type when I do the echo I get a very trimmed version of the text.
The same result I have with
Expand|Select|Wrap|Line Numbers
  1. $ree=mssql_query("select CONVERT(TEXT,descr1) from clroot.descriptions where id='1.00930'");
code green's Avatar
Expert
 
Join Date: Mar 2007
Location: England
Posts: 1,076
#5: Oct 3 '08

re: Strore large texts in mssql and dispaying them in php


The same thing occurs with Access data and php.
I think it is a known php bug but check this out
manual
Reply