Results 1 to 1 of 1

Thread: data base won't save info

  1. #1
    Join Date
    Jun 2006
    Posts
    3

    Default data base won't save info

    when you fill out the form the information is not saved in the database. It acts like it's working and I don't get any errors on the screen.
    This is my code.


    // Enable sessions
    session_start();
    // Turn on magic quotes to prevent SQL injection attacks
    if(!get_magic_quotes_gpc())
    set_magic_quotes_runtime(1);
    // Connect to database
    $eg_objConn1 = mysql_connect("localhost", "xxxxxx_xxxxxx", "xxxxxxx");
    // Validate users input
    if(!empty($_POST))
    {
    // Check that password is numbers and letters
    if(isset($_POST['password'])) if(ereg("[!\"£\$%\^&\*()_\+=\-\{}~#[.].][.[.]:@';<>\?/\.,|\\ ]", $_POST['password'])) $eg_error['password'] = "Your password contains illegal charactures, only use alpha-numeric charactures.";
    // Check username has a value
    if(empty($_POST['username'])) $eg_error['username'] = "You must enter a user name!";
    // Check that confirmPass is the same as (comparison)
    if(isset($_POST['confirmPass'])) if($_POST['confirmPass'] != @$_POST['password']) $eg_error['confirmPass'] = "Your passwords do not match!";
    // Check that username is numbers and letters
    if(isset($_POST['username'])) if(ereg("[!\"£\$%\^&\*()\+=\{}[.].][.[.]#~';:@/\.,<>\?\\| ]", $_POST['username'])) $eg_error['username'] = "The user name contains some illegal charactures, only use alpha-numeric charactures.";
    // Get Record Set
    $eg_reccount_username = mysql_query("SELECT COUNT(username) FROM easyGen_userDetails WHERE username = '".$_POST['username']."'", $eg_objConn1);
    $eg_count_username = @mysql_fetch_array($eg_reccount_username, MYSQL_ASSOC);
    // Check if username is in data source
    if($eg_count_username['COUNT(username)'] > 0) $eg_error['username'] = "The user name you supplied is already in use!";
    // Close recordset
    if(isset($eg_reccount_username)) @mysql_free_result($eg_reccount_username);
    // Check password has a value
    if(empty($_POST['password'])) $eg_error['password'] = "You must enter a password!";
    // Check email is a valid email address
    if(isset($_POST['email'])) if(!ereg("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,}\\.[0-9]{1,}\\.[0-9]{1,}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,}|[0-9]{1,})(\\]?)$", $_POST['email'])) $eg_error['email'] = "You must enter a valid email address!";
    // Check if any errors were returned and run relevant code
    if(empty($eg_error))
    {
    // Run query
    mysql_query("INSERT INTO `easyGen_userDetails`(`username`, `passwrd`, `firstName`, `surname`, `email`, `phone`) VALUES('".@$_POST['username']."', '".@$_POST['password']."', '".@$_POST['firstName']."', '".@$_POST['surname']."', '".@$_POST['email']."', '".@$_POST['phone']."')", $eg_objConn1);
    // Set Session Value
    $_SESSION['xxxxx] = @$_POST['username'];
    // Go to page
    header("Location: pcmoreinfo.php");
    exit;
    }

    Can anyone help?
    Thanks
    Steve Yates
    Last edited by syates; 07-06-2006 at 07:30 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •