coding issue, Please help (resolved)
Posted: Wed Mar 21, 2012 11:43 pm
Hi all
please help me I know I am doing something dumb but just can't see what it is.
I am trying to write the register user script but keep getting
could not query players table
Please see code for my register.php and reguser.php
Any help would be great.
Register.php
Regards
Andy
please help me I know I am doing something dumb but just can't see what it is.
I am trying to write the register user script but keep getting
could not query players table
Please see code for my register.php and reguser.php
Any help would be great.
Register.php
Code: Select all
<?php
include 'connect.php';
?>
<form method = "POST" action="reguser.php">
Type First Name Here: <input type="text" name="First" size="20"><br>
Type Last Name Here: <input type="text" name="Last" size="20"><br>
Type Password Here: <input type="text" name="password" size="20"><br>
Retype Password Here: <input type="text" name="password2" size="20"><br>
Type email address Here: <input type="text" name="email" size="60"><br>
<input type="submit" value="submit">
Reguser.php
<?php
include 'connect.php'
?>
<?php
$First=$_POST{'First'};
$Last=$_POST{'Last'};
$password=$_POST{'password'};
$password2=$_POST{'password2'};
$First=strip_tags($First);
$Last=strip_tags($Last);
$email=$_POST{'email'};
$email=strip_tags($email);
if ($email == "")
{
echo "You have not entered an email address!";
echo " <A href='Register.php'>Go back</a><br>";
exit;
}
if ($password==$password2)
{
$isFirst="SELECT * from players where name='$First'";
$isFirst2=mysql_query($isFirstname) or die ("could not query players table");
$isFirst3=mysql_fetch_array($isFirst2);
$isLast="select * from players where name='$Last'";
$isLast5=mysql_query($isLast) or die ("could not query players table");
$isLast6=mysql_fetch_array($isLast5);
if($_POST('password') || $_POST('password2'))
{
print " You did not enter a password";
echo "<a href='Register.php'>Go back</a><br>";
exit;
}
else if(($isFirst3 || strlen($First)>20 || strlen($First)<1) && ($isLast6 || strlen($Last)>20 || strlen($Last)<1))
{
print "there is already a player with that name or the name you entered is over 20 letters or less then 1 letter";
echo "<A href='Register.php'>Go back</a><br>";
exit;
}
else
{
$password=md5($password);
$SQL = "INSERT into players(First, Last, password, email) VALUES ('$First', '$Last', '$password', '$email')";
mysql_query($SQL) or die("could not register");
print "Thank you for registering";
}
}
else
{
print "Your password didn't match or you did not eneter a password";
echo "(A href='Register.php'>Go back</a><br>";
exit;
}
?>Andy