s.no name email
1 abc .abc@gmail
2 abc1 abc1@gmai
3 abc3 abc3@gmail
////////// and so on…///////////////////
Here my question is how to do bulk insert in Mysql Prepare statement if fetching values after clicking submit button link : $name = $_POST[‘name’]; it will fetch abc3 value only…
You need to use an array name for the form fields - name=‘name[]’ You can then loop over the array of submitted data using a foreach loop. You would prepare the query once, before the start of the loop, then just get and use each set of values when you execute the query inside the loop.
You are selecting ALL the columns from one table but only using ONE column and then duplicating that data by inserting the data from that one column to another table, thus duplicating the same exact data that is in the first table. Why? There is a problem somewhere.
Ohhh that one only for testing purpose…
my destination is bulk inserting id from one table to another table and other values are different like bulk assigning product to Tailor…
Once user is came and booked some product (ex 5 items ) and stored into DB(with one booking ID) after that admin can search product (ex shirt) it will show around 10 products and i want to assign to one person. If one by one Not a problen, I want to bulk assign to one person…
You don’t want to store the email, you want to store a link to that email. What happens when you need to update an email address? Now you have to update it across the spectrum. Instead, you update it in one table and the link stays the same. When you query it, you always have the data from the one source of truth.
Next, why are you using an email from one table to insert into an name column? That means the column is not named properly and is confusing. And why are you selecting everything, when you are only interested in the email? This is a huge performance problem and isn’t anything that you should want to run twice.