在一个查询中的两个不同表中插入相同的ID

时间:2017-04-17 19:39:58

标签: php mysql

我目前正在使用PHP制作应用程序以进行在线调用。

我创建了3个不同的表:

  • 1次测试(测试ID,难度,所需时间和测试对象)
  • 2个问题(带问题)
  • 3 reponse(answers)

当我创建新测试时,我使用此查询:

$insert = $bdd->prepare(

  'INSERT INTO test (`test_ID`,`test_name`,`test_skills`, `test_level`, `test_time`, `test_creation`)

  VALUES (null, :test_name, :skills_ID, :level_ID, :time_ID, NOW());

  INSERT INTO question (`question_id`,`question_question`)

  VALUES ( ?????, :question_question)');

我想知道如何在同一查询中的两个表中使用相同的ID。我尝试使用LAST_INSERT_ID,但它不起作用。

我只需要获得" null"的值。之后重复使用它。

0 个答案:

没有答案
相关问题