Connecting Tech Pros Worldwide Forums | Help | Site Map

nonstandard symbols: function to replace?

guitarromantic@gmail.com
Guest
 
Posts: n/a
#1: Nov 22 '05
Hey all.

Some of my writers are submitting stuff they've typed into Word (ughh),
meaning we get annoying symbols instead of " and '. I know I can build
a search and replace into my submissions form to stop these at the
source, but I don't want to run this through the existing 500 articles.
Is there some kind of method or function to display these? My
database-pulled content just displays a ? for them at the moment.

Matt


Toby Inkster
Guest
 
Posts: n/a
#2: Nov 22 '05

re: nonstandard symbols: function to replace?


guitarromantic wrote:
[color=blue]
> but I don't want to run this through the existing 500 articles.[/color]

Why not?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

guitarromantic@gmail.com
Guest
 
Posts: n/a
#3: Nov 22 '05

re: nonstandard symbols: function to replace?


Because I'd have to manually go through each one and process it through
the system..? Or are you suggesting I run it into phpMyAdmin or
something and just do a global replace? That could work.

chotiwallah
Guest
 
Posts: n/a
#4: Nov 22 '05

re: nonstandard symbols: function to replace?



guitarromantic@gmail.com wrote:[color=blue]
> Because I'd have to manually go through each one and process it through
> the system..? Or are you suggesting I run it into phpMyAdmin or
> something and just do a global replace? That could work[/color]

best idea in my opinion would be to clean up before putting the stuff
into the database. once you have that clean up script, i'd adapt it to
run it over the 500 articles once and for all.

micha

Toby Inkster
Guest
 
Posts: n/a
#5: Nov 22 '05

re: nonstandard symbols: function to replace?


guitarromantic wrote:
[color=blue]
> Because I'd have to manually go through each one and process it through
> the system..?[/color]

Please quote the post you're replying to so that people know what you're
talking about.

No need to do it manually! Say you have a function "fixsymbols()" that can
fix the symbols, simply create a script like this:

$r = mysql_query("SELECT articleid, content FROM articles;");
while ($a = mysql_fetch_array($r))
{
$id = $a[0];
$content = addslashes(fixsymbols($a[1]));
$q = "UPDATE articles SET content='$content' WHERE articleid='$id';";
mysql_query($q);
}

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Closed Thread