I am getting the following error message:
Warning: mysql_connect(): Unknown MySQL Server Host '<127.0.0.01>' (0) in /home/chillou/public_html/login/connect.php on line 25
If I change Host to '<localhost>' I get the same error message with localhost instead of 127.0.0.01
the entire connect.php script where this error is occuring is:
// Connect to the MySQL server
$link = mysql_connect('<127.0.0.01>', "<username>", "<password>");
// Select Database
mysql_query('USE phpsms');
?>
I also get two other areas from the createnewuser.php script. Even though it says the user was created successfully, they are not in the database.
the errors are:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/chillou/public_html/login/createnewuser.php on line 138
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/chillou/public_html/login/createnewuser.php on line 150
User has been created successfully.
Click login at the top to login.
The errors are coming from somewhere in this script:
exit(); // If there are errors then we quit this script
}
// Use Connect Script
include("connect.php");
// Get date from MySQL Server
$currentdatetime = mysql_query('select now()');
$curdatetime = mysql_result($currentdatetime,0);
/ Check if username exists. If not then add all data to the database.
If so then ask user for another name to try. /
// MD5 Username and Password
$username = MD5($username);
$password = MD5($password);
// Check if the username exists
$usernameinuse = mysql_query("SELECT * FROM userdata WHERE userid = '$username'");
$isusernameinuse = mysql_num_rows($usernameinuse);
// If username exists then print error message and exit script
if ($isusernameinuse == 1) {
echo "The username you selected is already been used by another member.<BR>Go back and select a new username";
exit;
}
else {
// Find out how many users there are so that you can determine the next user number
$usercount = mysql_query("SELECT * FROM userdata");
$noofusers = mysql_num_rows($usercount);
// New user number = User number + 1
$usernumber = $noofusers + 1;
// Insert the new user to the database since everything is fine
mysql_query("INSERT INTO userdata VALUES ('$username','$password','$postcode','$emailaddress','$curdatetime','$ipaddress','$usernumber','$usernamereal')");
// Print Successful Creation of user message
echo "User " . $usernamereal . " has been created successfully.<BR>Click login at the top to login.";
}
?>
Can someone please help me straighten this out?
Thanks!