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!

    you dont need the <> around your server address - i don't know if that would cause a problem.

    also your ip should be 127.0.0.1 - alternately you could use your public ip - find it here: http://whatismyip.com/

    Also check your MySQL server is running.

    I would say its one of them thats causing all your problems.

    • Matt

      Is Mysql installed?
      If not do the following.
      Mysql_install_db // install mysql
      Service mysqld restart // restarting service
      Mysql_admin –u root password ‘your password’ //set password
      Mysql –u root –p //to see if you can get in
      Quit

      If it is installed make sure it running
      Service mysqld start
      U can also in you setup at services select mysqld to make sure it starts at boot.

        Yes, mysql is installed. the database has been tested through phpmyadministration. I ran a query test when I first set it up (before the errors) and it works fine.

        mysql is also starting and running

        thanks for the responses. daph, i'll check out those other issues when i return sat.

          Write a Reply...