Category Archives: string

MySQL Database Find and Replace Field Text Query Syntax

Hey there,

You might have stopped while working with applications where you wanted to find some specific string values from the database & replace with another value. This can be easily achieved within the MySQL database. The syntax for FIND & REPLACE operation on MySQL database as follows.

Where,
yourTableName is the name of the Database Table.

YourFieldName is the Field name corresponds to the Database Table yourTableName.

stringToFind is the String to find from the field value.

stringToReplace is the string to be replaced for the existing stringToFind string.

For eg.

Let’s say YourFieldName value as Name is a very Good boy. Name is very intelligent also. You can’t see any boy like Name..;)

And if you want to replace Name with Jax try the following query.

After the query execution, New YourFieldName value will be

Jax is a very Good boy. Jax is very intelligent also. You can’t see any boy like Jax ..;)

That’s it..Share this..Cheers..:)

PHP How to remove numbers from string?

Hey there,

While parsing any document (HTML, XML or aything!), You might have involved in a stage where you would need to remove numeric values (numbers) from the string. PHP has some useful function which will make this easy as butter..:)

The above PHP code makes use of the functions range(), str_replace(), trim().

range() : Create an array containing a range of elements

str_replace() : Replace all occurrences of the search string with the replacement string

trim() : Strip whitespace (or other characters) from the beginning and end of a string

That’s all. Share it..Enjoy Coding..Cheers..:)