Archive

Archive for June, 2009

How to check execution time of a page

June 7th, 2009

Code:

// Add this in top of the script

$page_start_time = microtime(true);

 

// Add this in top of the script

if($page_start_time != 0){

       $page_end_time = microtime(true);

$differ = number_format($page_end_time - $page_start_time , 4);

echo “Page Load Time:  ”.$differ.” Seconds”;

}

Author: gaurav Categories: PHP Tags:

MYSQL Query to export data order by given values in comma separated string:

June 7th, 2009

MYSQL Query to export data order by given values in comma separated string.  If you want to get the record in an specific order you can do it like this:

SELECT * FROM {TABLE_NAME} WHERE {FIELD_NAME} IN ( 23, 234, 543, 23 ) ORDER BY FIELD({FIELD_NAME}, 23, 234, 543, 23 )

Example:  SELECT * FROM `product_master` WHERE paSKU IN (’1a6′,’1a1′,’1a8′,’1a3′,’1a4′) ORDER BY FIELD (paSKU,’1a6′,’1a1′,’1a8′,’1a3′,’1a4′)

Author: gaurav Categories: MySQL Tags:
Site is Under Construction