note 67941 added to function.mysql-fetch-array

From: Date: Fri, 07 Jul 2006 05:13:05 +0000
Subject: note 67941 added to function.mysql-fetch-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-114528@lists.php.net to get a copy of this message
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; }; ---- Server IP: 195.222.164.18 Probable Submitter: 81.23.124.235 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php Edit -- http://master.php.net/note/edit/67941 Del: integrated -- http://master.php.net/note/delete/67941/integrated Del: useless -- http://master.php.net/note/delete/67941/useless Del: bad code -- http://master.php.net/note/delete/67941/bad+code Del: spam -- http://master.php.net/note/delete/67941/spam Del: non-english -- http://master.php.net/note/delete/67941/non-english Del: in docs -- http://master.php.net/note/delete/67941/in+docs Del: other reasons-- http://master.php.net/note/delete/67941 Reject -- http://master.php.net/note/reject/67941 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#114528) next »