note 89590 added to function.rand

From: Date: Sun, 15 Mar 2009 16:56:47 +0000
Subject: note 89590 added to function.rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-151971@lists.php.net to get a copy of this message
As an further optimization on janoserki[at]gmail[dot]com previous post i would recommend that you optimize you first part of php/sql code to something like this. <?php // estimate the number of rows in a table $lekerdezes = mysql_query("select count(*) as rows from table"); while ($row = mysql_fetch_assoc($lekerdezes)) { $max = $row["rows"]; } ?> the count(*) is much faster for the database than grabbing the hole dataset from the table. ---- Server IP: 212.63.193.10 Probable Submitter: 85.24.227.50 ---- Manual Page -- http://www.php.net/manual/en/function.rand.php Edit -- https://master.php.net/note/edit/89590 Del: integrated -- https://master.php.net/note/delete/89590/integrated Del: useless -- https://master.php.net/note/delete/89590/useless Del: bad code -- https://master.php.net/note/delete/89590/bad+code Del: spam -- https://master.php.net/note/delete/89590/spam Del: non-english -- https://master.php.net/note/delete/89590/non-english Del: in docs -- https://master.php.net/note/delete/89590/in+docs Del: other reasons-- https://master.php.net/note/delete/89590 Reject -- https://master.php.net/note/reject/89590 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#151971) next »