Jump to content

dgilby

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dgilby's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks foxsoup really appreciate that. All the documentation that I seen was for the way I had it.
  2. Thanks I will try that. My server doesn't have mysqli functionality. They are apparently working on it. then I will change the code
  3. Hi I get the following error. Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource on line 24 Could someone take a look at this and provide an explaination. I also tried the SQL statement in phpadmin and it works fine. This is my first script and I desparately need a second pair of eyes. ** CODE ** <?php // require_once('connectionvariables.php'); // connect to the database $dbc = mysql_connect('localhost', 'dereyorg', 'nespephi', 'dereyorg_Test'); // $db = mysql_select_db('dereyorg_Test'); // check if variables are set when submit button is pressed if (isset($_POST['submit'])) { $firstname = mysql_real_escape_string($dbc, trim($_POST['firstname'])); $lastname = mysql_real_escape_string($dbc, trim($_POST['lastname'])); $email = mysql_real_escape_string($dbc, trim($_POST['email'])); $username = mysql_real_escape_string($dbc, trim($_POST['username'])); $password = mysql_real_escape_string($dbc, trim($_POST['password'])); } // mysql validation if (!empty($firstname) && !empty($lastname) && !empty($email) && !empty($username) && !empty($password)) // make sure username isn't already taken $query = "SELECT * FROM members WHERE username = '$username'"; $data = mysql_query($dbc, $query); if (mysql_num_rows($data) == 0) { // if username is unique, insert into database $query = "INSERT INTO members (firtname, lastname, email, username, password) VALUES ('$firstname', '$lastname', '$email', '$username', SHA('$password'))"; mysql_query($dbc, $query); echo '<p>Your account has been successfully created. You\'re now ready to <a href="login.html">Login</a></p>'; mysql_close($dbc); exit; } else { // an account already exists for this username, display error echo '<p class="error">An account already exists for this username. Please select a different username</p>'; $username = ""; } mysql_close($dbc); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.