Page 1 of 1
Slashes - MySQL doesn't like them so use stripslashes()?
Posted: Fri Jan 28, 2005 8:14 am
by mjseaden
Hi,
I'm trying to record a data element into a MySQL database which includes forward slashes ('/').
Am I correct in that MySQL doesn't like / characters in text fields, and so you have to use stripslashes(), or is there some other way?
Many thanks
Mark
Posted: Fri Jan 28, 2005 8:16 am
by feyd
forward slashes don't matter... it's quotes which are duplicates of the ones used to create the mysql string that are the problem.
Posted: Fri Jan 28, 2005 8:23 am
by mjseaden
I get an error for the following query :-
SELECT PageID FROM 4e58fbc769d276713def15dbd0065de6 WHERE PageURL='
http://uk.yahoo.com/'
???
Many thanks
Mark
Posted: Fri Jan 28, 2005 8:30 am
by feyd
what does the error say?
Posted: Fri Jan 28, 2005 8:31 am
by mjseaden
Code: Select all
Error: Could not perform MySQL query - You have an error in your SQL syntax near '4e58fbc769d276713def15dbd0065de6 WHERE PageURL='http://uk.yahoo.com/'' at line 1
Posted: Fri Jan 28, 2005 8:32 am
by feyd
that has to do with your table name... place it in backticks: `
note ` is not '
Posted: Fri Jan 28, 2005 8:35 am
by mjseaden
weird - why is that?
Posted: Fri Jan 28, 2005 8:36 am
by feyd
it's not recognized natively as a table's name.... or rather a reference to data for MySQL
Posted: Sat Jan 29, 2005 2:32 pm
by Joe
You may be able to use entities. Give it a try!
Posted: Sat Jan 29, 2005 2:45 pm
by timvw
SELECT PageID FROM 4e58fbc769d276713def15dbd0065de6
woooow, in that case i would choose a different table name.
as already mentionned, escaping with backtick the name will do too.