Decode HTML entities from the Strings

Sometimes we need to decode HTML entities from any specific strings in PHP. Basically it’s more used for retrieve HTML entities from a MySQL cell.? To Convert all HTML entities to their applicable characters there is one function available that is called html_entity_decode().



$orig?=?"I'll?"love"?the?<b>girl</b> very much";



echo?$a;?//?I'll?&quot;love&quot;?the?&lt;b&gt;girl&lt;/b&gt; very much

echo?$b;?//?I'll?"love"?the?<b>girl</b> very much?>

apostrophe s (‘s) problem in MySQL query

When you will work with your Blog or something in PHP, MySQL. Then your user may enter apostrophe s (‘s) into the post writing area. Then it will cause a problem for executing your MySQL Query. To execute your query for MySQL you can use mysql_real_escape_string($yourStrings).


<form method=”post” action=””>
<input type=”text” name=”user_name” value=”wallpaperama’s”>
<br />
<br />
<input type=”submit” name=”Submit” value=”Submit”>

$user_name = mysql_real_escape_string ($_POST[‘user_name’]);

and write your mysql query. It will be executed without any error. It’s more secured to post data to MySQL database.

For know more details please go to mysql_real_escape_string() in PHP Function Manual.


Check existence of a PHP Function in PHP

Sometimes when you make many functions in your PHP scripts. Then you need to check the real existence of the function you need. That’s why to check a function’s existence, you can write a little piece of code like the following:

NameOfTheFunction means your function's name. If your function is LoginCheck(). Then you need to write only LoginCheck. Just omitt the () symbol.

If it is helpful for you please make comments and share it.


How to write in a .txt file with PHP

To write values or text in a .txt file you can follow the following process in PHP.

It will make a text file named test_file.txt and in that file this PHP code snippet will write ‘Hello’.


Want a campaign management web application idea for small company

Still finding some solution or idea that can be useful for online campaign management for any small company. I am still finding for my own company.

May be I will go forward to build this system myself. But it’s new to me. Need idea. I am searching for the solution and gathering experience to make that more professional.