Languages :: PHP :: SQL, Ignore errors |
|||
| By: Zeman4323 |
Date: 30/09/2003 00:00:00 |
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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








