Jump to content

SQL If Already Exists In DB


marcus

Recommended Posts

if a user already exists in the database they cannot register at all, or have to choose a new username

edit: many of my user tend to attempt to register multiple times, and when i view the member list there they are, right next to each other
Link to comment
Share on other sites

[code]

<?php

$username=addslashes($_POST['username']);
$email=addslashes($_POST['email']);
$ip=addslashes($_POST['ip']);

$query="SELECT * FROM `users` WHERE `username`='$username' or `email`='$email' or `ip`='$ip' "

$result=mysql_query($query);

if(mysql_num_rows($result)){

echo "Sorry but you have a account with us!"

}

?>
[/code]
Link to comment
Share on other sites

[quote author=mgallforever link=topic=110627.msg447561#msg447561 date=1160085805]
It isnt working

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/neoblob/public_html/inc/do_reg.inc on line 20
[/quote]

Did you change your table- and fieldnames etc. ?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.