I'm banging my head against the wall on this one. I have an MSSQL database which stores information from an online form. I also have a PHP script that pulls information from this database, one record at a time, to display on a .php page.
Four of the columns, that are set to VARCHAR(2000), contain values that are about 1000 characters long. These values come from a <textarea> field on a separate form. When I view the table in SQL Server Management Studio Express, I can see the full 1000 character values. Because of this, I know the insert query is working properly.
The problem comes when I try to echo these values in the PHP script, it only echoes 250 characters. What would prevent this from echoing the full 1000 characters?
Some things that I've tried, none of which work:
- I've tried to echo the value with the nl2br() function.
- I've tried print instead of echo. (if there is even a difference anymore)
- I've tried making a separate query string and result set that only fetches one of the 1000-character values, and echoing that.
- I've checked my code on the W3C validator; it IS valid.
- I've tried different settings for the <textarea>'s "wrap" attribute.
- I've changed the html tags around the echoed value to <p>, <pre>, <span> etc.
- I've made sure the CSS is not affecting these tags by not linking it.
Here's a sample of my code:
The textarea:
<textarea name="question22" rows="4" cols="50" wrap="hard"></textarea>
The query:
$query = "SELECT * FROM dbo.academic_success_assessments WHERE assessment_id = '$assessment_id'";
$result = mssql_query($query);
$row = mssql_fetch_array($result,MSSQL_ASSOC);
The display:
echo "<p>".$row['question20'].</p>";