Page 1 of 1

Links being cut off due to ? symbols

Posted: Wed Feb 11, 2009 9:02 am
by mattpointblank
Hi all,

Working with an MSSQL database (ugh) and my page dies before finishing the output. The data is a text field and contains a long URL with multiple parameters. I've verified that it works fine in the database - if I manually copy the row contents into a new HTML page, it displays properly.

The generated code ends like this:

Code: Select all

 <p><a href="http://i.WEBSITE.com/portal/server.pt/gateway/PTARGS_32_0_1851_0_-1_47/http;/i-collab.WEBSITE.com;7001/collab/do/document/overvie</body>
Whereas the code in the database is like this:

Code: Select all

 <p><a href="http://i.WEBSITE.com/portal/server.pt/gateway/PTARGS_32_0_1851_0_-1_47/http;/i-collab.WEBSITE.com;7001/collab/do/document/overview?projID=881618&folderID=872460">http://i.WEBSITE.com/port...</a></p> 
It's ending at the overview?projID= part - is this a special character or something?

Any tips? Thanks.
Matt

Re: Links being cut off due to ? symbols

Posted: Wed Feb 11, 2009 10:24 am
by pickle
? is a special character in that it denotes the beginning of the query string part of a URL. It's hard to say if it's relevant to your problem or not without seeing some code. Are you doing any regular expression matching that might be getting caught up on the '?' ?

Re: Links being cut off due to ? symbols

Posted: Wed Feb 11, 2009 10:29 am
by mattpointblank
Yeah, I knew it was special in that sense but there's other links on the page using that format that work fine... possibly because they're not at the end? Anyway, I was using this regex: viewtopic.php?f=1&t=94730&p=517340#p517340 but for testing I've disabled it, so it shouldn't make a difference - I'm literally just echoing out the database output.

Re: Links being cut off due to ? symbols

Posted: Thu Feb 12, 2009 4:50 am
by mattpointblank
If it helps, my code is as basic as this:

Code: Select all

 
$query = "SELECT convert(text, Content) as Content FROM tblContent WHERE ContentID = '25'";
$result = mssql_query($query) or die;
$row = mssql_fetch_row($result);
$content = $row[0];
 
//$content = preg_replace('~<a href="([^"]*)">([^<]{26}).+?</a>~is', '<a href="$1">$2...</a>', $content);
// not using this function for now, to ensure it's working
 
echo $content;
 
This produces the code in my first post.

Re: Links being cut off due to ? symbols

Posted: Thu Feb 12, 2009 6:16 am
by mattpointblank
Never mind, fixed it. Added this code before any output:

ini_set("mssql.textlimit", "120000");

and this just before the query:

mssql_query("set textsize 76800");

Damned MS SQL...