Here is my problem

I have created a user login system (flash+php+mysql)
And it just about works

Here's the prob when i go to register as a new user the code wont properly
check to see if the username already exsist's in the DB, I am pretty sure
the problem lies in my first $query


PHP:------------------------------------------------------------------------
------
$query = "SELECT name FROM contacts WHERE name='$name'";
if ($name == $name) {
print "loginT=UserName in Use";
}else{
$query = "INSERT INTO contacts (name, pass, email, id) VALUES ('$name',
'$pass', '$email', NULL);";
}
$result = mysql_query($query);
// Gets the number of rows affected by the query as a check.
$numR = mysql_affected_rows($Connect);
if ($numR == 0) {
// Sends output to flash
print "loginT=Error - Register Again";
}
else if ($numR == 1) {
// Sends output to flash
print "loginT=Success&checklog=1";
}

----------------------------------------------------------------------------
--


If i take out
PHP:------------------------------------------------------------------------
------
$query = "SELECT name FROM contacts WHERE name='$name'";
if ($name == $name) {
print "loginT=UserName in Use";

----------------------------------------------------------------------------
--

THe login system works fine but dupilcate entries can be submitted to the
database.

Please help i would love to get this up and running

Cheers



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to