oh and your SQL statement is wrong: SELECT * FROM table WHERE ---- you are missing the FROM...
--- Mike Tuller <[EMAIL PROTECTED]> 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()); > > > I am getting back an error mysql_num_rows(): > supplied argument is not a > valid MySQL result resource. I have looked over it > again and again, and > can't see what is wrong. Can anyone else see where > the problem might be? > > Mike > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php