How to update two database tables as the same Usernamethats logged in?

I have created 2 separate database tables in PHP/MySQL that I want to store user information in. The first user table I made the fields: id, username, password. The second table I made the fields: id, firstname, lastname, address, phone.
I want to make an update record page that is restricted by username and password that will update both table1 and table 2 from my MySQL database.
I have created a registration page, a login page and a restricted page for when the user signs in. On the restricted page I want to update the users information.
I have tried a few things and I can get the table that has the username field to update, I just can't get the second table to update with the first table.

Hmm.
Not sure where your going with the <select> menu.
The description you made:
"Both have an id column, which is presumably the record's primary key, but you need to create a relationship by storing the primary key of one table as a foreign key in the child (related) table. For example, you should insert the primary key of the first table in the second table as user_id. That enables you to identify which username and password are related to an individual listed in the second table"
Seems to be the direction that I'm looking for.
Now my question is how do I insert the primary key of the first table in the second table as user_id?
>
>"For example, you should insert the primary key of the first table in the second table as user_id"
Since both tables have an id column and they both are the primary key, do I just change the name of the second tables id column to "user_id" then?
Or is there an actual "insert the primary key to another table" function that I don't know about?

Similar Messages

  • How to update two database tables when using DatabaseProvider

    I'm a begginer and I've made an application which uses a database. In one page, I have a table which I've took it from "woodstock basic" palette. I was using DatabaseProvider to populate the table with data from a database table called "copii". My code is:
    //i'm check all the rows in the table to see if the field "IDCOPIIC" =0 and if true I will put the value of "newCopiiId"
    do {
    if (copiiDataProvider.getValue("IDCOPIIC").equals
    (new Long(0))) {
    copiiDataProvider.setValue("IDCOPIIC", new Long(newCopiiId));
    newCopiiId++;
    } while (copiiDataProvider.cursorNext());
    copiiDataProvider.commitChanges();
    My problem comes now because I have another database table tided with a foreign key by this one and I want to update this one too when I'm updating the "copii" table. I don't know how to do it ...I've tried in many ways but is impossible. Can anyone help me ! I'm desperate...I cannot figure it out how I could insert, update in two tables in the same time when I'm using DataProvider .
    Thanks in advance!

    Hmm.
    Not sure where your going with the <select> menu.
    The description you made:
    "Both have an id column, which is presumably the record's primary key, but you need to create a relationship by storing the primary key of one table as a foreign key in the child (related) table. For example, you should insert the primary key of the first table in the second table as user_id. That enables you to identify which username and password are related to an individual listed in the second table"
    Seems to be the direction that I'm looking for.
    Now my question is how do I insert the primary key of the first table in the second table as user_id?
    >
    >"For example, you should insert the primary key of the first table in the second table as user_id"
    Since both tables have an id column and they both are the primary key, do I just change the name of the second tables id column to "user_id" then?
    Or is there an actual "insert the primary key to another table" function that I don't know about?

  • How to insert into two differents tables at the same time

    Hi
    I'm newer using JDev, (version 3.1.1.2 cause the OAS seems to support just the JSP 1.0)
    and I want to insert into two differents tables at the same time using one view.
    How can I do that ?
    TIA
    Edgar

    Oracle 8i supports 'INSTEAD OF' triggers on object views so you could use a process similar to the following:
    1. Create an object view that joins your two tables. 'CREATE OR REPLACE VIEW test AS SELECT d.deptno, d.deptname, e.empname FROM DEPT d, EMP E'.
    2. Create an INSTEAD OF trigger on the view.
    3. Put code in the trigger that looks at the :NEW values being processed and determines which columns should be used to INSERT or UPDATE for each table. Crude pseudo-code might be:
    IF :NEW.deptno NOT IN (SELECT deptno FROM DEPT) THEN
    INSERT INTO dept VALUES(:NEW.deptno, :NEW.deptname);
    INSERT INTO emp VALUES (:NEW.deptno, :NEW.empname);
    ELSE
    IF :NEW.deptname IS NOT NULL THEN
    UPDATE dept SET deptname = :NEW.deptname
    WHERE deptno = :NEW.deptno;
    END IF;
    IF :NEW.empname IS NOT NULL THEN
    UPDATE emp SET empname = :NEW.empname
    WHERE deptno = :NEW.deptno;
    Try something along those lines.
    null

  • How to place two narrow portlets in the same row of a wide column

    Hi,
    How to place two narrow portlets in the same row of a wide column.
    Im using ALUI 6.1
    Thanks in advance
    sandeep

    As I understand there is no easy way to do it now. I guess in theory that can be done by customizing ALUI page layout source code, but this is significant efforts. Correct me if there is more easy way to do it.
    Edited by Bryazgin at 05/23/2007 7:32 AM

  • Connecting to two database instances using the same Toplink

    Hi,
    We are trying to create a process using BPEL where data from one database instance needs to be passed to the other. The process is compiling properly and we could deploy it in BPEL Process Manager. But when we try to run the process, the data is not getting inserted into the second instance. There is no error /exception being thrown at most of the time, but at times we are getting a 'Unique constraint error' eventhough there is no duplication of data.
    Can we connect to two different instances using the same toplink. How can we achieve this.
    Thanks in advance
    Pratheusha

    You need to use two different sessions with two different mapping descriptors

  • Connecting to two database instances from the same TopLink

    Hi,
    We are trying to create a process using BPEL where data from one database instance needs to be passed to the other. The process is compiling properly and we could deploy it in BPEL Process Manager. But when we try to run the process, the data is not getting inserted into the second instance. There is no error /exception being thrown at most of the time, but at times we are getting a 'Unique constraint error' eventhough there is no duplication of data.
    Can we connect to two different instances using the same toplink. How can we achieve this.
    Thanks in advance
    Pratheusha

    You need to use two different sessions with two different mapping descriptors

  • How to Test two UUT not at the same time??

    My test station need to test two UUT not at the same time ,Two UUT means two serial Number need to scan, and then test  each UUT after scan action . The two UUT are the same PCBA,all the test items are the same. So the sequence file is same. But how to realize it in TestStand ? Can you give me a simple example for that ? Thanks so much !

    Have a look at the process model options of TestStand. For your task I would  use the batch model. If I remember correctly there are also some examples delivered with Teststand. Search for MultiUUT and Processmodell in the examples directory of your Teststand installation.

  • How to update two different tables by ony one sql query???

    Hi All,
    i need to update two different talbes in a single sql query..
    i m using the following query
    UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12
    AND
    UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12
    i m getting the following error:
    Odbc driver returned an error (SQLExecDirectW).
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43093] An error occurred while processing the EXECUTE PHYSICAL statement. [nQSError: 17001] Oracle Error code: 936, message: ORA-00936: missing expression at OCI call OCIStmtExecute: UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12 AND UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12 . [nQSError: 17011] SQL statement execution failed. (HY000)
    SQL Issued: EXECUTE PHYSICAL CONNECTION POOL writeback UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12 AND UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12
    but when i m ushin the same query in Microsoft SQL Server it executes properly:
    please help me out...

    There's no valid syntax for this, but there are some tricks you could do to achieve it.
    i) You could place an update trigger on TABLE1 to update TABLE2 automatically.
    ii) You could define a view across both tables and add an INSTEAD OF UPDATE trigger to it to maintain them.
    If I had to do this I'd choose option2, but frankly I'd just be running two updates if it really was me.

  • How to make two Application Modules share the same entity cache?

    Hello everyone, I am using JDeveloper 11.1.2.3.0
    I have a little problem in my application through using two AppModules that contain also same ViewObjects. So to be clear one VO is declared in two AppModules. When I commit the view by using AppModule1 and then go to another page that uses the same VO but from AppModule2, I have to commit again, even through the row is previously stored in the database.
    I understood that this came because different AppModules use different entityCache for database communications.
    I am asking if anyone knows any option on how to sync the entity caches from the two appmodules, or how to make them use the same entity cache.
    Thank you

    You can make a copy of the app and give it another name, but it will use the same settings files no matter which you open. Settings aren't stored in the app, but in your Preferences.
    Firefox, being a Windows derivative, might have the capability to use "Profiles" where you'd set it up different for each profile. I don't use Firefox, so I don't know if that option exists.

  • How to have two seperate Itunes on the same computer for two Ipods?

    Is there a way to have two separate Itunes downloaded on the same computer for two different Ipods? My sister got a new Ipod and she wants to hook it up to the computer but when ever she does it just pulls up my Itunes and has all of my songs on there. How can we each have our own Itunes?

    There's many ways to accomplish this. You could create two accounts in Windows. That way everything is completely separate. Or, you could manually manage your music in iTunes -- this way it won't automatically sync your music onto her iPod. More info here:
    http://docs.info.apple.com/article.html?artnum=61148
    http://docs.info.apple.com/article.html?artnum=93779

  • How to make a control table with the same number of rows of its itab

    I'm creating a control table, but it always have the maximum number of lines possible.
    How can I make it so that it has only the same number of rows of it's internal table?

    solved partialy with this:
    MODULE locka_lin OUTPUT.
      DATA: lin TYPE i.
      DESCRIBE TABLE t_obj LINES lin.
      table_con-lines = lin.
    ENDMODULE.                 "  OUTPUT
    but it still doent work when lin = 0
    any simple way to solve it on that case?
    Edited by: RagnaRock on May 5, 2010 6:00 PM

  • How to sync two iPhones on to the same MacBook Pro?

    I have an iPhone 4 and previously I would sync my phone to my MacBook, but my husband bought me a PC.  So now instead of figuring out how to sync to my PC I would really just like to sync to his Macbook Pro, as I am using that more due to a new job.  How do I do this w/o messing my phone up the first time I sync and then how do I continue to do this without adding all his contact and calendar info into my phone too?  Also I am signing up for MobileMe and have questions about how that works with two iPhones in the house and using the same iTunes account for apps and such (we rarely if ever purchase music).
    Thanks so very much!!!

    The easiest least complicated way to keep your info and her info seperate and not worry about things is to take advantage of user profiles on your computer (in XP)...so each of you log into XP with your own accounts, thus iTunes (and any other software like mail, etc) all have your own settings.
    Otherwise, you will have to watch which account is logged into iTunes Store (click store and see what name is up top right in case you both have different accounts)...and make sure you are logged in with the right account before syncing. iTunes does know the difference between your phones so each can setup different settings of what to sync to, but your library on your computer will be mixed unless you do what I said first, use different profiles (user logins) for XP.

  • How to insert into 2 tables from the same page (with one button  link)

    Hi,
    I have the following 2 tables....
    Employees
    emp_id number not null
    name varchar2(30) not null
    email varchar2(50)
    hire_date date
    dept_id number
    PK = emp_id
    FK = dept_id
    Notes
    note_id number not null
    added_on date not null
    added_by varchar2(30) not null
    note varchar2(4000)
    emp_id number not null
    PK = note_id
    FK = emp_id
    I want to do an insert into both tables via the application and also via the same page (with one button link). I have made a form to add an employee with an add button - adding an employee is no problem.
    Now, on the same page, I have added a html text area in another region, where the user can write a note. But how do I get the note to insert into the Notes table when the user clicks the add button?
    In other words, when the user clicks 'add', the employee information should be inserted into the Employees table and the note should be inserted into the Notes table.
    How do I go about doing this?
    Thanks.

    Hi,
    These are my After Submit Processes...
    After Submit
    30     Process Row of NOTES     Automatic Row Processing (DML)     Unconditional
    30     Process Row of EMPLOYEES     Automatic Row Processing (DML)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    50     Insert into Tables     PL/SQL anonymous block     Conditional
    My pl/sql code is the same as posted earlier.
    Upon inserting data into the forms and clicking the add button, I get this error...
    ORA-06550: line 1, column 102: PL/SQL: ORA-00904: "NOTES": invalid identifier ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored
         Error      Unable to process row of table EMPLOYEES.
    Is there something wrong with the pl/sql code or is it something else?

  • How to place two text fields on the same line in adobe

    I am trying to create a form on adobe and I would like to have two unique text fields on the same line. Is this posible? 

    If you are using FormsCentral it is, the fields can be placed "side by side" in a row.  There is a "+" sign on the right side of the field that brings up a toolbar to add a field adjacent.  You can also right click on a field and select "Insert beside", or you can "drag and drop" fields next to one another or to a new row.
    Thanks,
    Josh
    PS - One note, if you are using the "desktop" application of FormsCentral that comes with Acroat Pro XI make sure the application is up to date by either using the "Help" - "Check for updates" menu item or by signing into the application so that you have the latest features including the side by side layout.

  • How to create two independent index in the same RH project?

    Hello everyone
    I used Rh html 9.
    I created a new index in my project to have two independent and different index, but the two index are connected. When I deleted one word in the new index, the same word is deleted in the first index.
    When I've created the second index, I didn't choose the option "from an existing index", because I wanted a new and empty index but RH created a copy of the existing index and linked with the existing index.
    It is possible toc reate a lot of different table of content and glossary but not different index ?
    If someone can explain me why it doesn't work for index.
    Thank you.
    Florence

    Hi there
    If you click File > Project Settings > General tab, is the index set to have keywords in Topics or the Index file (HHK)?
    If it's set for Index file (HHK) that would likely explain it because the keywords are stored directly inside the topics themselves.
    If the setting is already for Index file (HHK) I'm a bit stumped and can only fathom that maybe you have stumbled across a bit of a RoboHelp bug. I've not tried using multiple indexes before. Perhaps I should try and see.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

Maybe you are looking for