Click Fraud Protection
PHP related blog, freelancer to hire!

Posts Tagged mysql query

How to calculate database size in MySQL using sql query?

SELECT count(*) TABLES, concat(round(sum(table_rows)/1000000,2),’M’) rows, concat(round(sum(data_length)/(1024*1024*1024),2),’G’) DATA, concat(round(sum(index_length)/(1024*1024*1024),2),’G’) idx, concat(round(sum(data_length+index_length)/(1024*1024*1024),2),’G’) total_size, round(sum(index_length)/sum(data_length),2) idxfrac FROM information_schema.TABLES WHERE  TABLE_SCHEMA = ‘YOUR DATABASE NAME’;

Read more

Zend_db_table how to find row by multiple columns?

Maybe should dig more in ZF API, but found simple solution: class YourClass extends Zend_Db_Table_Abstract { public function findOneByParams(array $params) { // prepare query $query = $this->select(); // add our terms foreach ($params as $param => $value) { $query->where($param.’ = ?’, $value); } // find row $row

Read more