How to insert data in two tables at a time in php || Part-1

preview_player
Показать описание
This will be done using different . The process is like this:
.....................................................................................................

You can run multiple INSERTS once, however you cannot insert into two tables from one single INSERT Statement. Also make sure to get the last inserted ID with LAST_INSERT_ID() for the foreign key and use a semicolon ; between the two INSERTS
.....................................................................................................
Code part will be updated in part-2 .....
...................................................................................................

Рекомендации по теме
Комментарии
Автор

SM you have my tomb's up. Thanks a lot. If am to rate you 1 to 10, I will have my 10/10. I used your example to query two tables, using insert and update queries to effect change in two different tables at the same time. Thanks.

jude
Автор

Thanks for the example! Sound cuts out @4:28 fyi

ebenezerjayingalsbe
Автор

Thankyou for this tutorial,
I want to ask, how to insert into 2 tables if the tables have relation?

taufiqnurrahman
Автор

Please make 2 tables student and books. in which create a relation with these 2 tables as 1 to many.
Example- insert 1 record for 1 student having 10 books.
1 student have unique id for it. and every book also have unique id for book. so student table have id's more than one for each student.
how to do this sir?

priyankasawant
Автор

when we fetch data from two tables how can we store/insert into another table..Plz tell me.

sheezanawaz
Автор

It very helpfull tutorial ...
Please provide sourse code

buddhadevkarmakar
Автор

IN THIS CODE HOW WE CAN GIVE A STATEMENT THAT IF EMAIL OR PHONE NO IS ALREADY PRESENT IN THE DATABASE THEN IT SHALL NOT ADD THE DATA TO THE DATABASE
PLEASE REPLY

rajshinde
Автор

sir .search engeine me 3 ya issy ziada table ko join kar k kese display kar wa sakhty hai

ShahzaibKhan-whhh
Автор

Hello sir how to delete and update data

sns
Автор

I really can't understand your english, only the video title, your english pronuntiation is really difficult for me, can you please subtitle, thank you!

vkornnr
Автор

I wish you can speak english now. 3/10/2021

jonaldpenpillo
Автор

i have follow the video step but it show this error Fatal error: Uncaught mysqli_sql_exception: Cannot add or update a child row: a foreign key constraint fails (`accessories_beauty_dbst`.`customer`, CONSTRAINT `customer_ibfk_1` FOREIGN KEY (`accountId`) REFERENCES `account` (`accountId`) ON DELETE CASCADE) in Stack trace: #0 mysqli_query(Object(mysqli), 'INSERT INTO cus...') #1 {main} thrown in on line 85

uuuting_
join shbcf.ru