Assuming you are using a programming language to interact with the database, you can use a loop to insert multiple rows into the database based on the quantity provided in the input form. Here is an example code using PHP and MySQL:
// Retrieve the quantity from the input form
$quantity = $_POST['quantity'];
// Connect to the database
$con = mysqli_connect("localhost", "username", "password", "database_name");
// Loop through the quantity to insert multiple rows
for ($i = 0; $i < $quantity; $i++) {
$query = "INSERT INTO table_name (column1, column2, column3) VALUES ('value1', 'value2', 'value3')";
mysqli_query($con, $query);
}
// Close the database connection
mysqli_close($con);
In this example, $_POST['quantity']
is used to retrieve the quantity from the input form. Then, a loop is used to insert multiple rows based on the quantity provided. mysql_query()
is used to execute the SQL insert statement. Finally, the database connection is closed using mysqli_close()
.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-06-22 15:39:21 +0000
Seen: 14 times
Last updated: Jun 22 '23
How can records be counted from a category that is retrieved through another PHP and SQL query?
What is the method for showing errors in mysqli_query?
How can Laravel establish a connection with a MySQL database located remotely?
How can a web application be developed to send distinct emails upon clicking the SUBMIT button?
How can a PHP function be used to retrieve an HTML table?
How can multiple queries be merged into a single stored procedure in MySQL?
What does "waiting for handler commit" mean in relation to the slow writes experienced in MySQL 8?