i have a name John O'Smith that is stored in my DB but when i am echoing it out i am getting the error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Smith'' at line 1
what do io do rather than chaning the name
ignore a hyphen in a name
Moderator: General Moderators
-
jonnyfortis
- Forum Contributor
- Posts: 462
- Joined: Tue Jan 10, 2012 6:05 am
Re: ignore a hyphen in a name
I can see where you might encounter some issues in querying it, if you're wrapping strings in single quotes. For that I'd recommend prepared statements. Indeed, for most queries I'd recommend prepared statements.
Your post suggests you're running into problems when echoing out the results of a query, which is odd. Maybe post the code in question and exactly where the error is occurring?
Your post suggests you're running into problems when echoing out the results of a query, which is odd. Maybe post the code in question and exactly where the error is occurring?