PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
megaming
Forum Commoner
Posts: 27 Joined: Wed Dec 25, 2002 12:31 pm
Post
by megaming » Fri Feb 07, 2003 2:07 pm
Hi,
How would I get rid of speech marks and anything else that could mess up my mysql database from $var ?
I guess i'd use preg_replace but I dunno what to replace and how to find it.
daven
Forum Contributor
Posts: 332 Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:
Post
by daven » Fri Feb 07, 2003 2:26 pm
mysql_escape_string($var)
megaming
Forum Commoner
Posts: 27 Joined: Wed Dec 25, 2002 12:31 pm
Post
by megaming » Fri Feb 07, 2003 2:32 pm
really, is that it?!
will that work in my cron script too do you think?
lazy_yogi
Forum Contributor
Posts: 243 Joined: Fri Jan 24, 2003 3:27 am
Post
by lazy_yogi » Fri Feb 07, 2003 5:04 pm
what's a cron script ?
I've heard "crons job" before but dunno what it is
JPlush76
Forum Regular
Posts: 819 Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:
Post
by JPlush76 » Fri Feb 07, 2003 6:48 pm
cron is an automated script you schedule on unix boxes to run your php or other scripts at certain times. so if you wanted an email every night at midnight on how many customers signed up that day... you would write the php script that does it and then use a crontab to execute it at midnight.
and that function will work with a cron, any php commands will. its just executing a php page basically at a certain time
megaming
Forum Commoner
Posts: 27 Joined: Wed Dec 25, 2002 12:31 pm
Post
by megaming » Sat Feb 08, 2003 3:09 am
It is still letting quotation marks into my database!!
Help
megaming
Forum Commoner
Posts: 27 Joined: Wed Dec 25, 2002 12:31 pm
Post
by megaming » Sun Feb 09, 2003 5:26 am
anyone?!
Please!!
JPlush76
Forum Regular
Posts: 819 Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:
Post
by JPlush76 » Sun Feb 09, 2003 1:18 pm
addslashes()
and then stripslashes()
hob_goblin
Forum Regular
Posts: 978 Joined: Sun Apr 28, 2002 9:53 pm
Contact:
Post
by hob_goblin » Sun Feb 09, 2003 1:23 pm
It's letting quotes in, but they won't be messing up your database.
Stoker
Forum Regular
Posts: 782 Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:
Post
by Stoker » Sun Feb 09, 2003 1:31 pm
if you want to strip anything but let's say 0-9,A-Z, dot, comma and dash you could do something like
$safetext = preg_replace('/[^A-z0-9,.\-]/','',$unsafevar);