1

Hi i want to do the equivalent of a string replace in php through mysql. My column has the string format "Release Date: Thursday 20th May 2012" I want to release the text release date:. I have tried this but with no avail

$query = ("UPDATE Films SET Film_Release = REPLACE(Film_Release, 'Release Date: ','"); 

$runquery = mysql_query($query);

Thanks guys

3
  • 2
    Maybe because of the typo's? Try this $query = "UPDATE Films SET Film_Release = REPLACE(Film_Release, 'Release Date: ','')"; Commented Apr 16, 2012 at 13:15
  • 1
    looks like you're missing apostrophe at the end where you're specifying the replacement string Commented Apr 16, 2012 at 13:15
  • what WouterH said. You're missing the second apostrophe of the replacement string and the closing bracket of the MySQL REPLACE function Commented Apr 16, 2012 at 13:20

1 Answer 1

2

Try with an extra ' and with a closing )

$query = "UPDATE Films SET Film_Release = REPLACE(Film_Release, 'Release Date: ','')"; 
Sign up to request clarification or add additional context in comments.

1 Comment

what a perfect copy/paste of my comment :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.