Re: count vs mysql_num_rows

From: Date: Tue, 09 Oct 2007 00:45:16 +0000
Subject: Re: count vs mysql_num_rows
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-262942@lists.php.net to get a copy of this message
At 12:47 PM -0700 10/8/07, Kevin Murphy wrote:
Is this a joke? You are using a LIMIT 1, so your count is always going to be 1.
No, its not a joke. The answer is not going to always 1, its going to be 1 (the value exists in the DB at least once) or 0 (the value doesn't exist in the DB), that's what I am trying to test for. I don't need to know how many times something exists, just if it does. -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada College www.wnc.edu 775-445-3326
Kevin: Considering what you want to do, you might want to investigate having mysql do it for you, see here: <http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html> Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#262942) next »