Wallpaper for iPhone Help?

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

Was this solution helpful to you?

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:

Just Added Q & A:

Find solution

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.