Anyway the error I'm coming up with is...
Quote
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mitchpe/public_html/page/create_member.txt on line 24
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mitchpe/public_html/page/create_member.txt on line 27
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mitchpe/public_html/page/create_member.txt on line 27
Here is my code...
<?php
//Connect to the database using con_members.php with the include function.
include('con_members.php');
// Collecting data from a form using variables.
$username = $_POST['user'];
$password = $_POST['password'];
$nickname = $_POST['nick'];
$email = $_POST['email'];
$fullname = $_POST['fullname'];
//Now for error control, if a requested field is left empty.
if($username == NULL) { echo "Please fill in Username
"; }
if($password == NULL) { echo "Please fill in Password
"; }
if($nickname == NULL) { echo "Please fill in Nickname
"; }
if($email == NULL) { echo "Please fill in Email"; }
if($fullname == NULL) { echo "Please fill in Full Name"; }
//Check if the username or email is in use.
$userread = mysql_query("SELECT* `username` FROM `members` WHERE `username`='$username'");
$user_exist = mysql_num_rows($userread);
$emailread = mysql_query("SELECT* `email` FROM `members` WHERE `email`='$email'");
$email_exist = mysql_num_rows($emailread);
if ($user_exist>0) { echo "Sorry that username is already in use"; }
if ($email_exist>0) { echo "Sorry, that email is already in use"; }
else {
//If the username doesn't exist, here we insert the information to the table.
$query = "INSERT INTO members (username, password, email, name, nickname) VALUES('$username','$password','$email','$fullname','$nickname')";
mysql_query($query) or die("Sorry, there was a problem in the Database, please try again later.");
}
?>
This is the part of the code I think I am getting the error on...
$userread = mysql_query("SELECT* `username` FROM `members` WHERE `username`='$username'");
$user_exist = mysql_num_rows($userread);
$emailread = mysql_query("SELECT* `email` FROM `members` WHERE `email`='$email'");
$email_exist = mysql_num_rows($emailread);
Any help? Thanks.
