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
[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]
[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. ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.