[thelist] newbie php question
Joe Crawford
jcrawford at avencom.com
Tue Jun 26 16:25:36 CDT 2001
Heather Ruggio wrote:
> I have a script from an instruction book that is a
> news source. When there is a long "article," lots of
> slashes appear in it. I have another book that has
> information on the stripslash function, but I can't
> figure out how to get it to work with the other
> functions already in the script. This is what it
> originally looked like:
>
> ***
> $result = mysql_query($sql);
> while ($row = mysql_fetch_array($result)) {
> print("<tr><td bgcolor=\"#003399\"><b>");
> printf("<font
> color=\"white\">%s</font></b></td></tr>\n",
> $row["heading"]);
> printf("<td>By: <a href=\"mailto:%s\">%s</a>\n",
> $row["author_email"], $row["author_name"]);
> printf("<br>Posted: %s<hr>\n",
> $row["date"]);
> printf("%s</td></tr>\n",
> $row["body"]);
> }
> ***
>
> How do I use the stripslash function with that? And
> do I need to do something special when the article is
> going in to the database to protect the hard returns
> and quotes?
Well it seems to me you need the "stripslashes" command on the 12th line
- something like:
stripslashes($row["body"])
Check this:
http://www.php.net/manual/en/function.stripslashes.php
Someone some time ago I think it was here that you can type
www.php.net/functionname and it'll bounce you to the right page. So If I
go http://www.php.net/stripslashes it takes me to:
http://www.php.net/manual/en/function.stripslashes.php - which is a
rather tasty shortcut for those of us obsessed with URLs. :-)
I /hope/ this was helpful. But I can't tell - I think to make a
recommendation about how to format your data - we'd need to know a bit
more about your data.
Best,
Joe <http://artlung.com/>
--
................... Joe Crawford \\ Web Design & Development
..... mailto:jcrawford at avencom.com \\ http://www.avencom.com
.... San Diego \\ CA \\ USA \\ AVENCOM: Set Your Sites Higher
More information about the thelist
mailing list