[thelist] newbie php question

Michael Goddard michael at tdh-marketing.com
Wed Jun 27 07:41:36 CDT 2001


 From my understanding the stripslash is a PHP function that will strip all
slashes from a string.  However the slashes that you are referring to are
"escape" slashes.  They are not actual slashes in the string.

All the "escape" slashes do is allow the printing of the quotation marks.
If you did not do this then using double quotation marks would render the
script in a parse error.  You would have to use single quotation marks
instead.

Make sense?  If not I am sure it mentions something about the "escaping"
within either text books that you are reading.

Michael

-----Original Message-----
From: Heather Ruggio [mailto:hjrbaby at yahoo.com]
Sent: Tuesday, June 26, 2001 3:23 PM
To: thelist at lists.evolt.org
Subject: [thelist] newbie php question


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?

Thanks,
Heather Ruggio

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/





More information about the thelist mailing list