0

I have a table file, this table will keet PDF files

file(id, name, mime, size, data, created)

and a table studentForm, only texts will be kept here

studentForm(firstName, name, emailAddress, fieldStudy, university, semester, linkedin, number)

My insert in PHP is inserting only into studentForm table:

$sql = "INSERT INTO studentForm (
            firstName,
            name,
            emailAddress,
            fieldStudy,
            university,
            semester,
            linkedin,
            number
       )
        VALUES (
             '$firstName',
             '$name',
             '$emailAddress',
             '$fieldStudy',
             '$university',
             '$semester',
             '$linkedin',
             '$number'               
        )";

I would like to insert data also into the file table. How can I do this JOIN table in a simple way?

RandomSeed
  • 29,301
  • 6
  • 52
  • 87
Oliveira
  • 1,321
  • 2
  • 11
  • 14
  • Couldn't you just use two insert statements? That seems easier to understand what is going on rather than combining the two. – David Ziemann May 14 '13 at 14:29
  • 2
    `INSERT INTO studentForm` is one query, you need to execute the other one too – Mr. Alien May 14 '13 at 14:29
  • 1
    You need to use 2 queries. see http://stackoverflow.com/questions/3860280/sql-insert-into-multiple-tables-in-one-query – Anigel May 14 '13 at 14:30
  • maybe following link will answer your question: http://stackoverflow.com/questions/175066/sql-server-is-it-possible-to-insert-into-two-tables-at-the-same-time – Ming M Zheng May 14 '13 at 14:32
  • what is name ? if these tables are to be linked steer toward id's (like int, not name) – Drew May 14 '13 at 14:37

0 Answers0