visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: PHP :: SQL, Ignore errors


By: Zeman4323 U.S.A.  Date: 30/09/2003 00:00:00  English  Points: 85 Status: Answered
Quality : Excellent
I keep getting errors when adding to the db due to symbols like 'I was wondering if anyone knew of a way to make sql ignore this error, i dont want to use addslashes()
thanks
By: Karitz Date: 30/09/2003 16:59:00 English  Type : Comment
there is the mysql_real_escape_string() function to do that


$item = "Zak's and Derick's Laptop";
$escaped_item = mysql_real_escape_string($item);


though it works more or less like the addslashes()
By: misterH Date: 01/10/2003 23:48:00 English  Type : Comment
Hi,

are you using it for a web application?
if so then you could replace the ' mark by it's notation in html, though not sure what this notation exactly is...

misterH
By: m_e_brown Date: 02/10/2003 00:34:00 English  Type : Comment
use htmlspecialchars with ENT_QUOTES.

ie $new = htmlspecialchars("Zak's and Derick's Laptop",ENT_QUOTES);

will return Zak's and Derick's Laptop

' is the html entity for '

By: Zeman4323 Date: 02/10/2003 01:08:00 English  Type : Comment
Im at school now, but ill try this when I get home, thanx for the suggestions
By: VGR Date: 02/10/2003 01:14:00 English  Type : Comment
m_e_brown gave you the correct answer, but I want to stress that YOU SIMPLY CAN NOT ask for that problem's resolution and at the same time write "I don't want to use addslashes'...

You SHOULD use addslashes() when writing to the DB, and stripslashes() when reading from it. This way it's tarnsparent for your users/applications, and safe for the DB

what more would you want ? ;-)
By: Zeman4323 Date: 02/10/2003 02:05:00 English  Type : Comment
yes, that sounds good, but i havent been able to get stripslashes to work...they dont strip

By: VGR Date: 02/10/2003 02:58:00 English  Type : Answer
tsssk tsssk tsssk

show me that part of your code... and sample "not strippable" data...
By: OpConsole Date: 20/05/2004 02:50:00 English  Type : Comment
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
Delete - no points refunded

Any objections should be posted here in the next 4 days. After that time, the question will be closed.
By: Zeman4323 Date: 20/05/2004 10:31:00 English  Type : Comment
jeez, my bad, you really help me, I dont know how I didnt accept your answer, this was one of my first times using european experts-exchange. Again, I am really sorry, and I accepted your answer
By: m_e_brown Date: 21/05/2004 18:44:00 English  Type : Comment
..err except I gave you htmlspecialchars ....

...never mind, worse things happen at sea.

U going sailing soon?

Do register to be able to answer

EContact
browser fav
page generated in 351.624010 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page