note 95329 deleted from function.mysql-num-rows by danbrown

From: Date: Mon, 28 Dec 2009 00:21:53 +0000
Subject: note 95329 deleted from function.mysql-num-rows by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-164368@lists.php.net to get a copy of this message
Note Submitter: ben -at- t e l k o t h -dot- net ---- lucky8919: MySQL can count things up for you if you ask it to. you'll consume less resources than fetching every row that way, too: $command = 'SELECT COUNT(idnum) AS num_users FROM users WHERE class=2'; $result = mysql_query($command); $data = mysql_fetch_assoc($result); // fetch result $count = $data['num_users'];

« previous php.notes (#164368) next »