Insert Script

Results 1 to 7 of 7
  1. #1
    Valued Member Anqui3tas is offline
    MemberRank
    May 2013 Join Date
    131Posts

    Insert Script

    I cant seem to figure out/remember how to get nUserNo into other tables in a similar script to this:


    insert into account.dbo.tUser (sUserID, sUserPW, sUserName, bIsBlock, bIsDelete, nAuthID, sUserIP)
    Values ('email', 'password', 'email', '0', '0', '9', '127.0.0.1')


    insert into account.dbo.tMinorsPlaytime (nUserNo, bIsAdult, nPlaytime) values (?, '1', '1')


    Insert into account.dbo.tUserOption (nUserNo, sEmail, sPhoneNo, bistext, nZipNo, sAddress, bIsMail, sAge, sIsReferred,sFirstName, sLastName)
    Values (?, 'Email', '1-555-555-5555', '1', '95006', '123 Street Name', '0', '24', '0', 'First', 'Last')

    as i would like this to be all one form.


  2. #2
    əʇılə ɯɐ ı fiestanerd69 is offline
    MemberRank
    Jun 2009 Join Date
    958Posts

    Re: Insert Script

    You can insert a row into the tMinorsPlaytime with the following query:

    Code:
    INSERT INTO Account.dbo.tMinorsPlaytime (nUserNo, bIsAdult, nPlayTime, dLogoutDate) VALUES (1, 1, 1000, GETDATE())
    As for getting the nUserNo, you need to get it when you insert it or use a select query to get it.

  3. #3
    Valued Member Anqui3tas is offline
    MemberRank
    May 2013 Join Date
    131Posts

    Re: Insert Script

    yeah i know i can insert a userno on the last 2 tables, but id like the script to pull the nuserno from the tUser table.
    so that i dont have to change the script each time. (as it will be a web form)
    is there a way to "get" that (nuserno) without going in to tuser and seeing which number it creates

  4. #4
    Account Upgraded | Title Enabled! LolOmgNoob is offline
    MemberRank
    Nov 2012 Join Date
    241Posts

    Re: Insert Script

    Why not add it all to a register form? It shouldn't be that hard, i'm sure some php users that linger around these parts still maybe help you get started.

  5. #5
    Account Upgraded | Title Enabled! Evildarkang is offline
    MemberRank
    Sep 2012 Join Date
    Northfield, BirLocation
    417Posts

    Re: Insert Script

    I will be attempting to build a php document without sql injection so you'll need to add that unto yourself. However i will make it for you.

  6. #6
    Valued Member Anqui3tas is offline
    MemberRank
    May 2013 Join Date
    131Posts

    Re: Insert Script

    Quote Originally Posted by LolOmgNoob View Post
    Why not add it all to a register form? It shouldn't be that hard, i'm sure some php users that linger around these parts still maybe help you get started.
    i guess i could do that, i just wasnt ready to start on web stuff yet.

    but id still like to learn how to pull info like that.

  7. #7
    əʇılə ɯɐ ı fiestanerd69 is offline
    MemberRank
    Jun 2009 Join Date
    958Posts

    Re: Insert Script

    Closing this thread seeing as there has been no update from OP.



Advertisement