INSERT INTO MYSQL TABLE AS PER INPUT DATE RANGE WITH A LOOP |
INSERT INTO MYSQL TABLE AS PER INPUT DATE RANGE WITH A LOOP |
shankar from vizag |
Apr 26 2022, 08:32 PM
Post
#1
|
Advanced Member Group: Members Posts: 202 Joined: 18-June 13 Member No.: 19,316 |
Greetings
________________________________________________________________ ID | Date | Name | Room Number _________________________________________________________________ 1 | 2022-05-01 | Thomas | 118 2 2022-05-15 Thomas 118 I have a mysql table to save the above data. It is for a room reservation and the person Thomas has a reservation from 2022-05-01 to 2022-05-15. I want to save the thomas name for 15 times in the table using loop inside the insert into query for mysql. At present I am using the following plain insert query not understanding how to use the loop to store the name as per the date range. $sql1 = "INSERT INTO allotment (date, name, room)VALUES ('$date', '$name', '$room')"; Kindly guide me to fix the issue for mysql. I am using xampp server 3.2.2 with php 5.6.40. Regards |
Lo-Fi Version | Time is now: 25th May 2024 - 08:21 AM |