get all table names from your database

SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA=’yourdatabase’;

How to Change Font Size onClick using JavaScript

add this script in your header:

<script type="text/javascript">
function textResize(text) {
  if (document.body.style.fontSize == "") {
    document.body.style.fontSize = "1.0em";
  }
  document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (text * 0.2) + "em";
}</script>

Then add this code anywhere in your body:

<a href="javascript:void(0);" onclick="textResize(1)">Make text bigger</a> | <a href="javascript:void(0);" onclick="resizeText(-1)">Make text smaller</a>

Detect Ipad, Iphone and Desktop using PHP


if(strstr($_SERVER['HTTP_USER_AGENT'],'iPad')){

     echo "Opened in IPad";

}else if(strstr($_SERVER['HTTP_USER_AGENT'],'iPod')){

     echo "Opened in IPhone";

}else{

     echo "Opened in Desktop";

}

Here comes the clear account of the code:

['HTTP_USER_AGENT']
This is the key in the server variable used in the code,serves the purpose of tracing out the gadget user has been utilizing.
It can be accessed from the server variable $_SERVER.
The code further follows up checking the gadget by simple If-Else loops and display the appropriate content.

How to Increase File Upload Size in WordPress

There are three methods to increase the file upload size.

1. functions.php in the Theme Folder

There are cases where we have seen that just by adding the following code in the theme function’s file, you can increase the upload size:

@ini_set('upload_max_size', '64M');
@ini_set('post_max_size','64M');
@ini_set('max_execution_time','300');

2. Create or Edit php.ini File

In most cases if you are on a shared host, you will not see a php.ini file in your directory. If you do not see one, then create a file called php.ini and upload it in the root folder. In that file add the following code:

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

3. In .htaccess file

Add the below lines in .htaccess filein the root folder and add the following code:

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

How to create Tag Cloud Page in wordpress

After exploring to create a cloud page  this is the way i have created one for my site

Follow the steps

1) create a php file with tagcloud.php

<?php
/*
Template Name: Tag Cloud
*/
?>

<?php get_header(); ?>

    <div id="content" class="narrowcolumn">
 		<h3 style="font-family:Arial, Helvetica, sans-serif; color:#CC6600">Tags Cloud</h3>
        <div class="tag_cloud">
            <?php wp_tag_cloud('number=0'); ?>
        </div>

    </div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

2) upload this file to server in your theme folder
in my case as i am using default theme i have uploaded to “flashallys\blog\wp-content\themes\default”

3) Login to admin section click on create a page
4) Enter title of your page
5) Choose Tag Cloud from the Template Drop Down and click update/create

Now your tag cloud page is ready
EnJoy!!!!!

Include PHP files in HTML pages using .HTACCESS

Usually, its not possible to include PHP files into HTML pages. Here i got a way for this which works. Its nothing but using .HTACCESS.

Create a .HTACCESS file in the root folder or a specified folder.
Add the below code  into your .HTACCESS file

Options +FollowSymLinks
AddType application/x-httpd-php .htm

Thats it

Now, you can include PHP files into your Static HTML Pages.

How to remove html tags from given text using PHP


function stripHtmlTags($text){

	$strippedtext = preg_replace(
					array(
						'@<head[^>]*?>.*?</head>@siu','@<style[^>]*?>.*?</style>@siu','@<script[^>]*?.*?</script>@siu','@<object[^>]*?.*?</object>@siu',
						'@<embed[^>]*?.*?</embed>@siu','@<applet[^>]*?.*?</applet>@siu','@<noframes[^>]*?.*?</noframes>@siu',
						'@<noscript[^>]*?.*?</noscript>@siu','@<noembed[^>]*?.*?</noembed>@siu',

						'@<((br)|(hr))@iu','@</?((address)|(blockquote)|(center)|(del))@iu','@</?((div)|(h[1-9])|(ins)|(isindex)|(p)|(pre))@iu',
						'@</?((dir)|(dl)|(dt)|(dd)|(li)|(menu)|(ol)|(ul))@iu','@</?((table)|(th)|(td)|(caption))@iu',
						'@</?((form)|(button)|(fieldset)|(legend)|(input))@iu','@</?((label)|(select)|(optgroup)|(option)|(textarea))@iu',
						'@</?((frameset)|(frame)|(iframe))@iu',
					),
					array(
						' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',"\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0","\n\$0", "\n\$0",
					),
					$text );

	return strip_tags($strippedtext);
}

echo stripHtmlTags("<div><strong>www.flashallys.com/blog</strong></div>");

email validation using regular expression with PHP


<?php
if(!empty($_POST['email'])){
	$regularexp = "^[A-Za-z0-9\.|-|_]*[@]{1}[A-Za-z0-9\.|-|_]*[.]{1}[a-z]{2,5}$";
	$email = $_POST['email'];
	$validemail = ereg($regularexp, $email);
	if ($validemail)
	{
		echo "<div style='color:green;'> <b>'$email'</b> is a valid email</div>";
	}
	else
		echo "<div style='color:red;'> <b>'$email'</b> is not a valid email</div>";
}else{
	echo "<div style='color:red; font-weight:bold;'> Please enter email</div>";
}
?>
<html>
	<body>
	<h2>Email Validator</h2>
	<form method="post">
		<div style="width:50px; font-family:Verdana, Arial, Helvetica, sans-serif; float:left; padding-top:3px;">
			Email:
		</div>

		<div style="width:300px">
			<input type="text" name="email" />
		</div>

		<input type="submit" />
	</form>
	</body>
</html>

remove an array element from array in php

While trying to delete any element from i am not able to find any function

      unset($arr[array_search($element, $arr)]);