Zend - The PHP Company




MS SQL

Add Code


MSSQL Fetch Text Loop  

Type: code fragment
Added by: phadeguy
Entered: 01/11/2001
Last modified: 01/11/2008
Rating: **** (4 votes)
Views: 9958
Can't get around the MSSQL 255 character read limit when fetching a row object? Here's a quick and dirty workaround...


<?php
$query 
"select substring(content,1,250) as content from page_content where page_content_id = $page_content_id";
$result mssql_query($query,$dbconn);
$row mssql_fetch_object($result);
$x=1;
$content "";
while (
$row->content!="") {
  
$content .= $row->content;
  
$query "select substring(content,(250*$x)+1,250) as content from page_content where page_content_id = $page_content_id";
  
$result mssql_query($query,$dbconn);
  
$row mssql_fetch_object($result);
  
$x++;
// while
?>


Usage Example




Rate This Script





Search



This Category All Categories