note 67941 deleted from function.mysql-fetch-array by nlopess

From: Date: Fri, 07 Jul 2006 09:41:00 +0000
Subject: note 67941 deleted from function.mysql-fetch-array by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-114532@lists.php.net to get a copy of this message
Note Submitter: sharpline at mail dot ru ---- I used this function in my CMS to calculate number of rows in returned table. <?php function row_calc($table, $equals = false, $control_field = false) //Calculating number of rows in table. // $control_field & $equals used to calculate how much rows with decided value I have in table { global $db_pre; $sql_calc = "SELECT SQL_CALC_FOUND_ROWS * FROM ".$db_pre.$table; if ($equals != false && $control_field != false) { $sql_calc .= " WHERE 1 AND ".$control_field." = '".$equals."'"; }; mysql_query($sql_calc); $sql_calc_res = "SELECT FOUND_ROWS()"; $sql_res = mysql_query($sql_calc_res); $calc_result = mysql_fetch_array($sql_res); $result = $calc_result[0]; return $result; };

« previous php.notes (#114532) next »