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

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

Techy Shubhasis

5 лет назад

57,957 Просмотров

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 .....
...................................................................................................
Keep update with us-- https://techshubhasis.blogspot.com/

https://www.smyoutube.com/

Тэги:

#How_to_insert_data_in_two_tables_at_a_time_in_php #php #mysql #database #how_to_insert_data_in_two_tables_at_a_time #how_to_insert_data_in_php #add_into_databse #javascript_in_hindi #php_in_hindi #php_tutorial #php_insert_update_delete #crud_operation_in_php #mysqli_connect_to_database_php_in_hindi #insert_code_in_php
Ссылки и html тэги не поддерживаются


Комментарии:

Shi Ting
Shi Ting - 30.04.2023 08:15

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 C:\xampp\htdocs\webProgramming_Ass\register-check.php:85 Stack trace: #0 C:\xampp\htdocs\webProgramming_Ass\register-check.php(85): mysqli_query(Object(mysqli), 'INSERT INTO cus...') #1 {main} thrown in C:\xampp\htdocs\webProgramming_Ass\register-check.php on line 85

Ответить
Sheeza Nawaz
Sheeza Nawaz - 02.04.2022 17:21

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

Ответить
Ghufran Ataie
Ghufran Ataie - 01.03.2022 04:34

you used photoshop 7 in 2018?????

Ответить
LiveCorp
LiveCorp - 19.12.2021 05:27

thank you thank you thnk you thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Ответить
Improve Programming Logic
Improve Programming Logic - 22.03.2021 22:33

Why u didn't use TRANSACTION

Ответить
Jonald Penpillo
Jonald Penpillo - 10.03.2021 16:18

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

Ответить
Jonald Penpillo
Jonald Penpillo - 10.03.2021 06:05

Speak English

Ответить
g
g - 31.01.2021 05:32

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!

Ответить
Aleksander Szycik
Aleksander Szycik - 29.10.2020 20:53

Very good tuturoal!

Ответить
Priyanka Sawant
Priyanka Sawant - 09.07.2020 09:32

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?

Ответить
Cangkir
Cangkir - 17.06.2020 16:25

how to activate view transactions and transaction history bro

Ответить
Jude
Jude - 07.05.2020 20:44

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.

Ответить
Taufiq Nur Rahman
Taufiq Nur Rahman - 10.04.2020 02:29

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

Ответить
Raj Shinde
Raj Shinde - 07.04.2020 08:03

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

Ответить
عبدالله يحيى
عبدالله يحيى - 26.01.2020 15:28

thank you, pro

Ответить
Frank Music
Frank Music - 18.10.2019 11:09

what if both data tables are related?

Ответить
PUPG&COD
PUPG&COD - 20.01.2019 17:08

Hello sir how to delete and update data

Ответить
Shahzaib Khan
Shahzaib Khan - 18.01.2019 20:58

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

Ответить
Jagan ML
Jagan ML - 22.11.2018 13:32

thank you it helped me

Ответить
Angelika Ramos
Angelika Ramos - 12.10.2018 20:31

Thank you so much sir!

Ответить
BUDDHADEV KARMAKAR
BUDDHADEV KARMAKAR - 14.07.2018 12:04

It very helpfull tutorial ...
Please provide sourse code

Ответить