[thelist] newbie php question

Michael Stevens mike at tokenzone.com
Tue Jun 26 14:43:54 CDT 2001


Heather:

You'll have to redifine your strings.  If you've added slashes to DB entries
to avoid problems and want to remove them when viewing the DB information on
a page just do something like this:

$slashStr = stripslashes ($slashStr);


-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Heather Ruggio
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





More information about the thelist mailing list