Re: mysql_num_rows

From: Date: Fri, 04 Apr 2003 22:25:04 +0000
Subject: Re: mysql_num_rows
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-142445@lists.php.net to get a copy of this message
Try: ($select_total_rows == 0) instead. That and maybe echo $select_total_rows; to see what it's returning. --- Mike Tuller <php@ce.anoka.k12.mn.us> wrote: > I can't get mysql_num_rows to work for some reason. > Here is a snippet > of what I have > > > $department_name = $_POST['department_name']; > > $select_query = "SELECT * WHERE department_name = > '$department_name'"; > $select_result = mysql_query($select_query, > $db_connect); > $select_total_rows = mysql_num_rows($select_result); > > if ($select_total_rows<1) > { > $insert_query = " insert into departments > (department_name) > values > ('$department_name')"; > > mysql_query($insert_query, $db_connect) or die > (mysql_error()); > __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com

« previous php.general (#142445) next »