Well this is my code..
function register($User, $Email, $Pass)
{
$conn = db_connect();
$result = $conn->query ("select * from members where User = '$User' ");
if (!$result)
echo('Could not execute query');
if ($result -> num_rows>0)
echo('That username is taken - go back and choose another one.');
$result = $conn ->query ("INSERT INTO members (User, Pass, Email, Date) VALUES ('$User', '$Pass', '$Email' , NOW())");
mysql_query($query) or die(mysql_error());
if (!$result)
echo('Could not register you in database - please try again later.');
return true;
}
db_connect() is already explain before this function..
my table is called members and there are 4 columns... User, Pass, Email, Date ....
So my database is well set....~I guess~
The $User is the correct name for the variable of the username the person typed...
So $User does exists and its ok...
When I press 'Register' in the form this message apears..:
Fatal error: Call to a member function on a non-object in /home/dobakat/public_html/Istariguild/phptests/new_members.php on line 26
which is:
$result = $conn->query ("select * from members where User = '$User' ");
I don't know what is wrong, because the name of the table is members, and the column is User and the variable $User does exist...
Can someone help me?