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

share|improve this question

60% accept rate
2  
Maybe because of the typo's? Try this $query = "UPDATE Films SET Film_Release = REPLACE(Film_Release, 'Release Date: ','')"; – WouterH Apr 16 at 13:15
1  
looks like you're missing apostrophe at the end where you're specifying the replacement string – Alexey Gerasimov Apr 16 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 – cypherabe Apr 16 at 13:20
feedback

1 Answer

Try with an extra ' and with a closing )

$query = "UPDATE Films SET Film_Release = REPLACE(Film_Release, 'Release Date: ','')"; 
share|improve this answer
what a perfect copy/paste of my comment :) – WouterH Apr 16 at 14:27
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.