PDA

View Full Version : Need help incorporating "strlen"


Aaron1
01-20-2003, 01:31 PM
I would like to set the maximum characters using STRLEN in this piece of code:
----------------------------------------------------

$result = mysql_query("SELECT title, threadid, dateline FROM thread WHERE forumid NOT IN ('10','12')ORDER BY dateline DESC LIMIT 40");

while($row = mysql_fetch_assoc($result))

{
echo "<tr><td><a onFocus=\"if(this.blur)this.blur()\" class=\"cap\" href=\"javascript:;\" onClick=\"opener.location='/forum/showthread.php?s=&threadid=".$row["threadid"]."'\">".$row["title"]."</a></td></tr>\r\n";

}

----------------------------------------------------

Because i would like to limit the number of characters .$row["title"] puts out.

I hope you can help out, because i haven't got a clue how to start.

N!ck
01-20-2003, 01:53 PM
------------------------------------
$result = mysql_query("SELECT title, threadid, dateline FROM thread WHERE forumid NOT IN ('10','12')ORDER BY dateline DESC LIMIT 40");

while($row = mysql_fetch_assoc($result))

{
echo "<tr><td><a onFocus=\"if(this.blur)this.blur()\" class=\"cap\" href=\"java script:;\" onClick=\"opener.location='/forum/showthread.php?s=&threadid=".substr($row["threadid"],0,MAX)."'\">".$row["title"]."</a></td></tr>\r\n";

}
------------------------------------

Replace MAX with the maximum number of characters you want to show.

Aaron1
01-20-2003, 02:24 PM
Thanks for helping but that didn't work for me. :(
I noticed that you didn't use the 'strlen' btw. Maybe that isn't nescesary?

And you incorperated it, into the link and not the RowTitle?

Best regards