War of the Lands
New Member
- Messages
- 11
- Reaction score
- 0
- Points
- 0
Code:
When i fill the form out and register it won't insert into the database and I also get this error when counting:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/warland/public_html/V1/register.php on line 20
PHP:
<?php
if (isset($_POST['submit'])) {
$pass=$_POST['pass'];
$user=$_POST['user'];
$email=$_POST['email'];
}
else {
register();
require_once "footer.php";
exit;
}
$result= mysql_query("SELECT * FROM 'login' WHERE (username = '$user')");
$check= mysql_num_rows('$result');
if ($check != 0) {
echo "'$user' has already been taken, please try another username!";
register();
require_once "footer.php";
exit;
}
else {
$pass2=md5($pass);
$active=rand();
$result= mysql_query("INSERT INTO login VALUES('$user', '$pass2', '$email', '$active')");
$to=$email;
$subject="Activation - War of the Lands";
$message="Your activation link: $active \r\n";
$message.="Copy this code into the input box on this page: \r\n";
$message.="http://www.warofthelands.x10hosting.com/V1/active.php";
$header="From: no-reply@warofthelands.x10hosting.com";
mail($to, $subject, $message, $header);
echo "<br>You have been sent your activation link. You need to activate your account before you can login!<br>";
}
require_once "footer.php";
?>
When i fill the form out and register it won't insert into the database and I also get this error when counting:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/warland/public_html/V1/register.php on line 20