Category Archives: Easy PHP

How to explode a string and create hyperlink?

Here is very easy code to create Tagged List with hyperlink.
I have found several events where we have to create dynamic URL with Tagged text.
I have used very simple approach. Just Exploded sting and replaced space with “-”
You can use PHP function preg_replace() or str_replace() then used here-docs for creating hyperlink.
Instead of Echo Hear Docs is much better solution.
And at last removed the last Comma, and return your comma separated Dynamic links.


How to Stop SQL Injection in MYSQL?

Every PHP-MYSQL programmer need to know Anti-SQL Injection.

Please take a look at very simple function which can save your database!!


How to Redirect with PHP?

You need to replace the URL above with the URL you wish to direct to.
Use this simple PHP script to redirect a user from the page they entered to a different web page.


How to display certain number of words from a record?

I got good php tutorial to display certain number of words from database; in place of Database record you can use any other regular string.


How to remove HTML Tags from string?

If your strings have image code, any html code or DIV code you can easily remove using this code.

Hope this little code will be useful for you.


How to display limited characters?

To display limited characters from database or from string there is a ready made function available in php it is called – substr ( string string, int start [, int length])

Out put will be – phpmind