The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> INSERT INTO MYSQL TABLE AS PER INPUT DATE RANGE WITH A LOOP
shankar from vizag
post 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th May 2024 - 11:23 PM