PHP Login System with Admin Features

Would you like to react to this message? Create an account in a few clicks or log in to continue.
PHP Login System with Admin Features

This forum was created to talk about the PHP Login System with admin features created by jpmaster77 on evolt's website


3 posters

    query question

    intothefantasy
    intothefantasy


    Number of posts : 37
    Registration date : 2009-04-11

    query question Empty query question

    Post  intothefantasy Wed Apr 29, 2009 8:17 am

    i am trying to play around with the script and i wanted to make more than 1 query...

    is like i wanna try something like this...
    Code:
    function addNewUser($username, $password, $email){
          $time = time();
          /* If admin sign up, give admin user level */
          if(strcasecmp($username, ADMIN_NAME) == 0){
            $ulevel = ADMIN_LEVEL;
          }else{
            $ulevel = USER_LEVEL;
          }
          $q = "INSERT INTO ".TBL_USERS." VALUES ('$username', '$password', '0', $ulevel, '$email', $time)";
          return mysql_query($q, $this->connection);

      }

    top here is the code for register...of course from the code above shows that the registered details will be insert in to users table...now i wan to insert more than 1 table...which mean in the same time i wanna insert those details in users table and another test table which i have duplicate out...i keep trying to create a new $z and not having any result...wat i doin here is that...i wanna make a big register form which has alot of fields...and some of the fields i wanted it to store userid in another table...
    Linchpin311
    Linchpin311


    Number of posts : 220
    Age : 38
    Localisation : Long Island
    Registration date : 2007-05-14

    query question Empty Re: query question

    Post  Linchpin311 Wed Apr 29, 2009 5:09 pm

    just to make sure we are on the same page here...

    you want to alter the register.php page and have a lot of fields? you then want to insert some of those fields into one table and insert other fields into another table? the two tables are not identical, correct?

    if so, you can just do two queries and execute them one right after the other. let me know if i am understanding you correctly.
    intothefantasy
    intothefantasy


    Number of posts : 37
    Registration date : 2009-04-11

    query question Empty Re: query question

    Post  intothefantasy Thu Apr 30, 2009 5:15 am

    i tried something like this and says i fail to register but still i saw the value has inserted to both tables

    Code:
    function addNewUser($username, $password, $email){
          $time = time();
          /* If admin sign up, give admin user level */
          if(strcasecmp($username, ADMIN_NAME) == 0){
            $ulevel = ADMIN_LEVEL;
          }else{
            $ulevel = USER_LEVEL;
          }
          $q = "INSERT INTO ".TBL_USERS." VALUES ('$username', '$password', '0', $ulevel, '$email', $time)";
          $result1 = mysql_query($q, $this->connection);
          $z = "INSERT INTO ".TBL_TEST." VALUES ('$username', '$password', '0', $ulevel, '$email', $time)";
          $result2 = mysql_query($z, $this->connection);
          return 0;

      }
    done something like this...can insert the values to 2 table...but problem is it will direct me to a fail register message....is know is the return problem...can anyone help me fix this?
    Linchpin311
    Linchpin311


    Number of posts : 220
    Age : 38
    Localisation : Long Island
    Registration date : 2007-05-14

    query question Empty Re: query question

    Post  Linchpin311 Thu Apr 30, 2009 10:23 pm

    well you are returning 0 when the original function calls to return the actual query. try changing
    Code:
          $q = "INSERT INTO ".TBL_USERS." VALUES ('$username', '$password', '0', $ulevel, '$email', $time)";
          $result1 = mysql_query($q, $this->connection);
          $z = "INSERT INTO ".TBL_TEST." VALUES ('$username', '$password', '0', $ulevel, '$email', $time)";
          $result2 = mysql_query($z, $this->connection);
          return 0;
    to
    Code:
          $z = "INSERT INTO ".TBL_TEST." VALUES ('$username', '$password', '0', $ulevel, '$email', $time)";
          mysql_query($z, $this->connection);

          $q = "INSERT INTO ".TBL_USERS." VALUES ('$username', '$password', '0', $ulevel, '$email', $time)";
          return mysql_query($q, $this->connection);
    let me know if changing this around gets things working for you.
    sketchone
    sketchone


    Number of posts : 2
    Registration date : 2011-03-03

    query question Empty Re: query question

    Post  sketchone Fri Jun 24, 2011 7:59 pm

    can u show how to do this step to step, i was trying to do this myself with two different registered froms, but one registration has more fields than the other because its for two different types of accounts. can you help me with this also please ?

    Sponsored content


    query question Empty Re: query question

    Post  Sponsored content

      Similar topics

      -

      Current date/time is Fri May 17, 2024 5:45 am