0
mysql_query( "INSERT INTO users(email, password) VALUES ('$email','$password')" );
$user_id = mysql_insert_id( );

mysql_query( "INSERT INTO business_details ( business_id, name, address, city, state, country, pincode) VALUES ('$category','$business_name', '$business_address', '$city', '$state', '$country', '$pincode')" );
$idB = mysql_insert_id( );

mysql_query( "INSERT INTO user_profiles (name, phone, user_id, business_details_id) VALUES ('$person_name', '$phone_number', '$user_id', '$idB')" );

What will be the best way to insert all queries in one? Is it possible?

Nehil Mistry
  • 1,101
  • 2
  • 22
  • 51

2 Answers2

1

No, it isn't supported in MySQL - only Oracle can do it.

Stephan Weinhold
  • 1,623
  • 1
  • 28
  • 37
0

MySQL doesn't support multi-table insertion in a single INSERT statement

Rex Rex
  • 1,030
  • 1
  • 8
  • 29