MySQL Forums
Forum List  »  PHP

Re: exist
Posted by: Jonathan Stephens
Date: June 04, 2005 10:40AM

SELECT COUNT(*) > 0 FROM tablename WHERE username='$username';

will return 1 (true) if there are any records in the table named 'mytable' where the username is $username and 0 (false) if there aren't.

Jon Stephens
MySQL Documentation Team @ Oracle
Orlando, Florida, USA

MySQL Dev Zone
MySQL Server Documentation

Options: ReplyQuote

Written By
June 03, 2005 09:27AM
Re: exist
June 04, 2005 10:40AM
June 27, 2005 04:24PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.