Jump to content

Single quote


Cyto

Recommended Posts

Hi,

 

I'm trying to delete a string that's single quoted. From: Cyto's to Cyto, but doesn't work. It works when I add 's to the string with stripslashes, but I can't seem to delete a quote from a string.

Does someone know how?

 

My $_post code:

$name=mysql_real_escape_string(stripslashes($_POST["ename"]));

 

Cheers

 

Link to comment
Share on other sites

Your trying to delete a row from your database based on the name value? We would need to see how it is stored in the database. Is it stored as Cyto's or Cyto/'s?

It's stored as Cyto and I add 's, it becomes Cyto's. Ok it works, but when I want to delete a row with 's in a string(Cyto's), it returns as Cyto's back instead of Cyto.

 

P.S Cyto as string is a example, there are other words.

Link to comment
Share on other sites

Please post the rest of the code. I don't know what you are trying to do right now. Please post code, don't just try to restate what you just said.

 

I'm trying to delete a row with a quote in a string and add a row with a quote in a string. The adding works with stripslashes, but the deleting part... I'm stuck there.

Link to comment
Share on other sites

Maybe:

 

UPDATE `table` SET `string` = REPLACE(`string`, "'", '')

 

If you need some kind of filtering add a WHERE clause.

Thx, but nvm. I figured it out myself. I added mysql_real_escape_string() in the where clause. It added a slash to the quoted strings. Worked.

Thank you too, teynon.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.