hi, i'm trying create a login page for my site and at this point i'm trying to write code so it doesn't let people create duplicates. The only problem im having is checkin the database to see if their's a duplicate listing. I dont know why this is so hard for me, i did just come back from vacation so i must be a little rusty. Any help would be appreciated. When i run the script i just get a blank page and it doesn't give me any errors. I commented out the code that checks for duplicates and it works. here it is:
<?php
// Check to see if user already exsists
include ("../connect.php");
$query = "SELECT * FROM members WHERE username ='$username'";
$result = @($query) or die("Couldn't execute query.");
if(mysql_num_rows($result) > 0) {
echo "<font color=\"#FF0000\">Name already exists.</font>";
echo "<font color=\"#FF0000\">Please go back and choose another one.</font>";
echo "<p align=\"center\"> <a href=\"javascript:history.back()\"><font color=\"#0000FF\">Back</font></a></p>";
}
// Performing SQL query
$query2 = "INSERT into members (first_name, last_name, city, state, email, username, password, phint, specials, membersince)
VALUES ('".$first_name."', '".$last_name."', '".$city."', '".$state."', '".$email."', '".$username."', '".$password."', '".$phint."', '".$specials."', 'a')";
$result2 = @($query2) or die("Couldn't execute query.");
include("../headerinc.php");
echo "<br>;
echo "Your account was created successfully!<br>";
echo "You will receive a confirmation e-mail shortly to activate your account.";
mysql_close();
?>