How to get a value from a table using functions and return count

How to get a value from a table using functions and return count: Write a simple query and pass the parameters: function somename($tablename, $colnam, $colvalue, $mode, $returncolnam) { Select $returncolnam from $tablenam where $colnam=$colval } Note: For $returncolnam you can also use array number starting from 0.

How to Check Domain Name availability in PHP

You can check domain name availability of a domain name by using following code. If you want to check multiple domains for same extension modify this code by calling function again. To check different extensions you need to specify Server Name and Matching Criteria for that extension. Pass values in $server and $nomatch [php] <?php … Read more

How to do Pagination in PHP easily

Pagination in PHP is easy and you can show pagination by following code. There are 4 files (don’t go to the number of files, separate sfiles have been created so that you can easily understand the code), I could have combined it in 1 but 4 seems to be better. These are: index.php, paging.php, function.php, … Read more

Get Page Name or File Name or Extension from Page URL

If you want to know Page Name, File Name, File Extension and directory name from a URL then you can use following function for it in PHP. [php]$path_name = "abc/xyz/name.somename.txt"; $path_parts = pathinfo($path_name); echo $path_parts[‘dirname’], "n"; echo $path_parts[‘basename’], "n"; echo $path_parts[‘extension’], "n"; echo $path_parts[‘filename’], "n";[/php] For more information you can visit: http://php.net/manual/en/function.pathinfo.php You can access its … Read more

How to show only some part of Email

Often we see that Email Address on websites are not shown completely but only first few characters are shown i.e. before @ part, 1 character after @ and last few characters of email address. It is used so that user (whose email id we are displaying) can recall what email address he has used. So, … Read more

Count Number of Files in Directory and Subdirectories

Count number of files in a directory and it’s subdirectories. Use the following code to count number of files. [php] <h1>Count Number of Files in Directory and Subdirectories</h1> <?php $dirnam=dirname(__FILE__); //No Trailing Slash// function count_files($dirpath, &$count) { $directorynames = glob($dirpath.’/*’); if(!empty($directorynames)) { foreach($directorynames as $directoryname) { if(is_dir($directoryname)) { $count[‘dirs’]++; count_files($directoryname, $count); } if(is_file($directoryname)) { $count[‘files’]++; … Read more