Results 1 to 3 of 3

Thread: simple SQL validation

  1. #1
    Join Date
    Nov 2007
    Posts
    151
    Thanks
    67
    Thanked 0 Times in 0 Posts

    Default simple SQL validation

    Hi

    I have a signup form for a my site, it includes username, password and email. I wanted to check that if the username or the email is already exist in my DB so It will write "this username or email is already in use"

    otherwise it should sign him to the site.

    I succeeded on making the signinig part, but not the validation.

    Can someone help me?

    Thanks

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    just do a selection query for the username / email and if it returns a value then its already in use

    PHP Code:
    if(mysql_query("SELECT username, email FROM Users WHERE username='_something_' OR email='_something_'"))
    {
       
    $error "Username already in use";


  3. #3
    Join Date
    Nov 2007
    Posts
    151
    Thanks
    67
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by boogyman View Post
    just do a selection query for the username / email and if it returns a value then its already in use

    PHP Code:
    if(mysql_query("SELECT username, email FROM Users WHERE username='_something_' OR email='_something_'"))
    {
       
    $error "Username already in use";

    Hi thank you for your help but I was needed it in SQL, cause I'm using ASP and Access.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •