MySQL replace text http://wallpaperbanta.com please help?
-
i have a database and website, http://wallpaperbanta.com in the database i have column called items, in each row their is details such as jessica alba iphone wallpaper 126, i want to remove end digits using a command (NOT TRIM as the digits can be 2 digits or 1) i want a command which will recognise the 'iphone wallpaper' bit and delete any text after that is this possible? someone please help me
-
Answer:
Dont do what rcwc (ireality) suggests. That will delete the entire record. From what I understand, you want to replace text in a field, keeping only part of each item value. You will want to use a combination of replace and substring_index. I'm assuming the descriptor, will be changing ( "jessica alba iphone wallpaper" ) for each item, so would be tedious to do as you would have to do for each item. It would be easier to write a script using PHP or another language. I would take the approach of looping over all records , finding the last part of each item ( by chopping off at the last space) and then running an update to replace the item, minus the last part of the string. //This much will give you the part you want to remove select SUBSTRING_INDEX( `item` , ' ', -1 ) as removeString from your table where..... // then update update table set item = replace(item, $removeString,' ') where .....
adeel451 at Yahoo! Answers Visit the source
Other answers
mysql_query("DELETE * FROM yourdatabase WHERE columnname LIKE '%iphone wallpaper%'"); The "LIKE" part is what you want, and you can use % as a wildcard statement, which will look for anything in columnname that has iphone wallpaper in it.
Related Q & A:
- Why cant i view my contacts display image? please help if you know ,thanks?Best solution by Yahoo! Answers
- I did something really bad and now i need help please help me.Best solution by Yahoo! Answers
- Help with TV show, please help?Best solution by Yahoo! Answers
- My HDMI cable won't work, please help?Best solution by Yahoo! Answers
- Distortion Coming Out of External Speakers? Please Help?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.