Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Register Info Not Inserting Into Tables

    Ok...here is my problem, I am trying to setup this script so that when a user hits the submit button the script will take the info and insert it into the database called "members" and it will send them an activation email. The issues that I am having are:

    1. The table is being created but none of the information is being stored into the database except for the ID and a timestamp that is all zeros.

    2. The username is not being displayed on the output page saying that your registration has been sent and that an activation email is on it's way.

    3. The activation email is not being sent.

    I have attached a copy of my script named: register2.txt in hopes that someone may be able to help me solve my issues.

    Thank You
    Attached Files Attached Files

  • #2
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    At the top, you have

    case "joinb":
    addmember($member);
    break;
    $member is nothing because you haven't set it to anything yet. You need to have this above the block I copied:

    PHP Code:
    <?php
    $member 
    $_POST['member'];
    ?>

  • #3
    New Coder
    Join Date
    Jun 2007
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Basicly what i would like to do with that part is just have it input the word "member"...it really has nothing to do with the script in a whole...it is basicly for the chat system to know who to assign admin or regular member rights too...so I would like it to default input member and for the time being until i code up a script to change the settings in the admin control panel I will just edit it manually in phpmyadmin. If you can think of a reason and possibly a solution as to why none of this information is being entered into the database please let me know...I have been trying to get this to work for the past couple of days and it is driving me insane lol

  • #4
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Another problem in your code...I see that you've set $status="member"; and then tried to use $status = $_POST['$status']; .

    First off, why do this? Why not just put 'member' in there?

    And second off, since you're using single quotes inside the POST, PHP does not parse variables. If you want PHP to parse that $status inside the POST, you need to use double quotes. Like so:

    PHP Code:
    $member $_POST["$status"]; 
    But if I were you, I would just use $_POST['member'] unless you have a special need for it.

  • #5
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Quote Originally Posted by Antec View Post
    If you can think of a reason and possibly a solution as to why none of this information is being entered into the database please let me know...I have been trying to get this to work for the past couple of days and it is driving me insane lol
    Once again, at the top of your page you are calling the function addmember($member), which has an argument that needs to be the $_POST information. The $member you are passing contains nothing, since you haven't set $member to anything above the function.

    And when you start using variables later on, you need to surround the array key with single quotes, like so:

    PHP Code:
    if(!$member['name']){


    Last edited by JohnDubya; 08-02-2008 at 06:02 AM.

  • #6
    New Coder
    Join Date
    Jun 2007
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    First I would liek to thank you for your insight on this....I have done what you said about changing from single to double quotes but it still will not save the information to the database. Nothing saves at all except for the ID and an empty time stamp. Here is what im tryin to pull from the form and post to the database:

    PHP Code:
    $status $_POST['member'];
    $member[name] = $_POST["$member[name]"];
    $ip $_POST["$ip"];
    $enurl $_POST["$enurl"];
    $member[gender] = $_POST["$member[gender]"];
    $member[country] = $_POST["$member[country]"];
    $member[chatpass] = $_POST["$member[chatpass]"];
    $member[email] = $_POST["$member[email]"];
    $anumber $_POST["$anumber"];
    $pass2 $_POST["$pass2"];
    $extrasql $_POST["$extrasql"];

    $query="INSERT INTO members (id, status, name, ipaddress, salt, gender, country, password, chatpass, email, joined, act)VALUES ('NULL', '".$status."', '".$member[name]."', '".$ip."', '".$enurl."', '".$member[gender]."', '".$member[country]."', '".$pass2."', '".$member[chatpass]."', '".$member[email]."', 'NULL', '".$anumber."')";

    mysql_query($query) or die ('Error Updating The Database...Please Contact Antec@ClanGamez.com'); 

  • #7
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    PHP Code:
    <?
    /*======================================================================*\
    || #################################################################### ||
    || # Elite Gaming Ladder v2
    || # ---------------------------------------------------------------- # ||
    || # Copyright ©2007-2008 Elite Gaming Ladder LLC. All Rights Reserved. ||
    || # This file may not be redistributed in whole or significant part. # ||
    || # ------------------- EGL IS NOT FREE SOFTWARE ------------------- # ||
    || #                   http://www.eliteladders.com                    # ||
    || #################################################################### ||
    \*======================================================================*/
     
    session_start();
    include(
    "./includes/incglobal.php");

    $member $_POST['member'];

    switch(
    $action){

    case 
    "joinb":
    addmember($member);
    break;

    case 
    "activate":
    activate();
    break;

    default:
    newteam($team);
    break;
    }

  • #8
    New Coder
    Join Date
    Jun 2007
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That still doesn't solve the problem that the information in the form is not being saved to the database. Like i said it creates a new table and gives it a unique ID like it is supposed to but the info: ip, email, passwords, and so on is not being saved...all the fields are blank in the database when i look at it in phpmyadmin

  • #9
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Post/upload your current code/file
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #10
    New Coder
    Join Date
    Jun 2007
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is the updated script: register_updated.txt
    Attached Files Attached Files

  • #11
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    There are a lot of inconsistencies and errors in your code. You really need to go back in and look over it more carefully. Here are some:

    Don't use single quotes around your HTML tags (don't do this: <table width='90&#37;'> ). Always use double quotes. I'm sure you're doing this because you started $out[body].=" with double quotes, but you don't have to do that. Start with single quotes, and when you come to a variable that needs to be parsed, use concatenation (a period). Concatenation just means linking things...it "glues" stuff together. Like so:

    PHP Code:
    $out['body'] .= '<tr bgcolor="'.$config['altcolora'].'">'
    Also, with all of your array values, you need to use single quotes inside of the square brackets.

    PHP Code:
    //Use this:
    $member['name'] = '';

    //Instead of this:
    $member[name] = ''
    And in this section, I'll comment my suggestions:

    PHP Code:
    //Why are you setting this? You only use it in the query, but $_POST['member']
    //is an array, so nothing will go into the database from this variable.
    $status $_POST['member'];

    //You need to just set $member to have the POST info and then call up $member['name'].
    //Like this:
    $member $_POST['member'];

    //Then, you can simply call $member['name'] and it will have whatever the user
    //typed in for his name.

    $ip $_POST["$ip"];
    $enurl $_POST["$enurl"];

    //Same thing as above applies for these.
    $member[gender] = $_POST["$member[gender]"];
    $member[country] = $_POST["$member[country]"];
    $member[chatpass] = $_POST["$member[chatpass]"];
    $member[email] = $_POST["$member[email]"];
    $anumber $_POST["$anumber"];
    $pass2 $_POST["$pass2"];
    $extrasql $_POST["$extrasql"];

    //Then for this, make sure you put single quotes inside each array value, like
    //I described above.  $member['name'] instead of $member[name]
    $query="INSERT INTO members (id, status, name, ipaddress, salt, gender, country, password, chatpass, email, joined, act)VALUES ('NULL', '".$status."', '".$member[name]."', '".$ip."', '".$enurl."', '".$member[gender]."', '".$member[country]."', '".$pass2."', '".$member[chatpass]."', '".$member[email]."', 'NULL', '".$anumber."')"

  • #12
    New Coder
    Join Date
    Jun 2007
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for all your help guys, I am pretty noob so I thank you for your time and effort. Ok so JohnDubya I think I have done what you said but im not too sure so I have uploaded another copy of my script titled: register_updated.txt
    Attached Files Attached Files

  • #13
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    By using these declarations:

    PHP Code:
    $member['name'] = $_POST['$member[name]'];

    $member['gender'] = $_POST['$member[gender]'];
    $member['country'] = $_POST['$member[country]'];
    $member['chatpass'] = $_POST['$member[chatpass]'];
    $member['email'] = $_POST['$member[email]']; 
    you are actually setting $member['name'] and all the rest to nothing, since $_POST['$member[name]'] and the rest mean nothing. You need to remove all of those. You already checked these variables earlier in the code, so why even have these additional declarations?

    There are still more array values that need to have single quotes in them...like for $email[toname] and the other $email array values. Are we getting it to work now?

  • #14
    New Coder
    Join Date
    Jun 2007
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok so you are saying that this:
    PHP Code:
    $member['name'] = $_POST['$member[name]'];

    $member['gender'] = $_POST['$member[gender]'];
    $member['country'] = $_POST['$member[country]'];
    $member['chatpass'] = $_POST['$member[chatpass]'];
    $member['email'] = $_POST['$member[email]']; 
    should be like this?
    PHP Code:
    $member[name] = $_POST['$member[name]'];

    $member[gender] = $_POST['$member[gender]'];
    $member[country] = $_POST['$member[country]'];
    $member[chatpass] = $_POST['$member[chatpass]'];
    $member[email] = $_POST['$member[email]']; 
    and what shoudl be in the "name & value" parts of the form itself? because as it is right now it is pulling this error:

    "Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /homepages/41/d245653625/htdocs/gaming/register.php on line 56"

  • #15
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Like I said before, all array values need the single quotes in them. So

    $member['name']

    should always be used. Now, as for what I said...I mean you need to completely erase those extra declarations, since they are clearing your form data. It needs to be like this:

    PHP Code:
    $ip $_POST['$ip'];
    $enurl $_POST['$enurl'];

    $anumber $_POST['anumber'];
    $pass2 $_POST['pass2'];
    $extrasql $_POST['extrasql'];

    $query="INSERT INTO members (id, status, name, ipaddress, salt, gender, country, password, chatpass, email, joined, act)VALUES ('NULL', '".$status."', '".$member['name']."', '".$ip."', '".$enurl."', '".$member['gender']."', '".$member['country']."', '".$pass2."', '".$member['chatpass']."', '".$member['email']."', 'NULL', '".$anumber."')";

    mysql_query($query) or die ('Error Updating The Database...Please Contact Antec@ClanGamez.com'); 


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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