Hi there 
I have this user creation form. I also have the login. Now I’m trying to implement a “Keycode system”, where the user needs a special keycode to actually create the user. All the keycodes are stored in a seperate table called “keys”, where the users are stored in a row called “brugere”.
So i need to check if the keycode that they enter is acutally found in the row “keys”.
I have tried to do this by inserting this:
[php]
$amount = mysql_result(mysql_query(“SELECT COUNT(*) FROM keys WHERE key = ‘$_POST[keycode]’”),0);
if($amount < 1)
{
[/php]
But i get this error:
Parse error: syntax error, unexpected T_ELSE in C:\wamp\www\opretbruger.php on line 25
I should propably post my code here it is:
[php]
<?php include ("database.php"); if($_GET['do'] == "opretbruger") { $antal = mysql_result(mysql_query("SELECT COUNT(*) FROM brugere WHERE brugernavn = '$_POST[brugernavn]'"),0); if($antal < 1) { if(!empty($_POST['brugernavn']) && !empty($_POST['kodeord']) && !empty($_POST['email'])) { [b] // THIS IS WHAT I INSERTED[/b] $amount = mysql_result(mysql_query("SELECT COUNT(*) FROM keys WHERE key = '$_POST[keycode]'"),0); if($amount < 1) { $password = md5($_POST['kodeord']); mysql_query("INSERT INTO brugere (brugernavn,password,email,specialcode) VALUES ('$_POST[brugernavn]','$password','$_POST[email]','$_POST[keycode]')")or die(mysql_error()); print 'Succes'; } else { print "The keycode was invalid"; } else { print "Please fill out all fields"; } } else { print "The requested username is already in use - please choose another username"; } } else { ?>
Create a user
Fill out the fields below to create a user
Username:
Password:
Email:
Keycode:
I’m truly sorry if all this is messy but i really hope someone will help me.
Thanks have a good day! 