Jump to content

How to submit data into two tables in mysql

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
kwesiaryee

kwesiaryee

    Newbie

  • Members
  • Pip
  • 2 posts
Hi,

I have two related tables in mysql database and both use the same foreign key. I want to put both tables under one submit form so that the data supplied can go to both tables with no errors.

How can do that?

#2
Turk4n

Turk4n

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 3,847 posts

kwesiaryee said:

Hi,

I have two related tables in mysql database and both use the same foreign key. I want to put both tables under one submit form so that the data supplied can go to both tables with no errors.

How can do that?

I think you should visit the Java Help forum :)
http://forum.codecall.net/java-help/

Posted Image

#3
Guest_Jordan_*

Guest_Jordan_*
  • Guests
I've moved your thread, please do not post questions in the tutorial section. Thank you Turk4n for letting us know.

I moved your question to the Java section because you had it in the Java Tutorials section, however, your question involves MySQL which is commonly used in Web Development rather than desktop/Java development. What language are you trying to connect to the MySQL database with?

#4
Turk4n

Turk4n

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 3,847 posts

Jordan said:

I've moved your thread, please do not post questions in the tutorial section. Thank you Turk4n for letting us know.

I moved your question to the Java section because you had it in the Java Tutorials section, however, your question involves MySQL which is commonly used in Web Development rather than desktop/Java development. What language are you trying to connect to the MySQL database with?

Np, Jordan and thanks for moving it !
Posted Image

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Just collect all the data you need, and then run the two insert statements.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
kwesiaryee

kwesiaryee

    Newbie

  • Members
  • Pip
  • 2 posts
I am connecting with java: connection pool to mysql

#7
morefood2001

morefood2001

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,720 posts
As winged said, you need 2 insert statements. Since you will be connecting to 2 tables, use the mysql table select command to select each table then insert the appropriate values.