SQL in the database..little help please
| From: | Ryan A | Date: | Wed, 10 Mar 2004 01:24:04 +0000 |
| Subject: | SQL in the database..little help please | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-179963@lists.php.net to get a copy of this message | ||
Hi,
I need to save some SQL queries into the MySql database for later use,
I thought this was done pretty simply by doing a addslashes before insert
so that someones name like like " O'reilly " does not screw up the insert
and
a stripslashes for reading from the DB.
I did that but when I checked in the DB I couldnt find the O/'reilly as it
saves it
normally as "O'reilly". (Did a little more reading and found out the
database does not
input O/'reilly but understands that its " O'reilly " but if you dont use
stripslashes..you're
screwed)
I anyway wanted to make sure and went to the online php manual...there I got
totally
confused as some say dont use add slashes at all for portability or we have
to also escape
the % and # if we are using a LIKE in the statement...and a whole lot of
other stuff.
I have first put off magic_quotes...now can anybody tell me how YOU are
doing it so I can
do it the same damn exact way...reading online is a problem coz I am getting
conflicting ways
of doing it....or am just braindead looking at code all day, either
way..your answer is appreciated.
Thanks,
-Ryan