Re: Value Checking

From: Date: Thu, 26 Oct 2000 01:43:52 +0000
Subject: Re: Value Checking
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-22000@lists.php.net to get a copy of this message
$sql = "SELECT username FROM user_table WHERE username='$try_me'"; $r = mysql_query($sql); if(@mysql_num_rows($r)){ echo 'OH MY GOD YOU CAN NOT HAVE THAT NAME!!!!'; }else{ echo 'GOOD TO GO!!!'; } --Joe On Wed, Oct 25, 2000 at 01:10:46PM -0700, Phillip S. Baker wrote: > Okay I want to run a query against the DB to see if a new user is trying to > take the name of an existing user at the web site. > > The users are placed in a members table in a MySQL database. > > How would I run a simple check like this on the DB. I understand the > if...else part that I would need to write. If the User matches an existing > user return to previous page else run this insert script. But how would the > code look for the checking query? > > Thanks > > Phillip S. Baker > > phillip@wordsandimages.com > Words & Images > 1535 Seabright Avenue, Suite 100, Santa Cruz, CA 95062 > Direct Line (831) 420-2641 / Fax (831) 458-0808 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net ================================================================================ = Joe Stump joestump98@yahoo.com http://www.miester.org = ================================================================================ "Real programmers don't comment their code. It was hard to write, it should be hard to understand."

« previous php.general (#22000) next »