note 129562 added to reserved.variables.server

From: Date: Fri, 07 Jun 2024 02:26:29 +0000
Subject: note 129562 added to reserved.variables.server
Groups: php.notes 
Request: Send a blank email to php-notes+get-221364@lists.php.net to get a copy of this message
<?php // Database connection parameters $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "factory"; $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $minQuantity = $_POST['minQuantity']; $sql = "SELECT product_code, product_name, quantity_in_stock FROM products WHERE quantity_in_stock >= ?"; $stmt = $conn->prepare($sql); $stmt->bind_param("i", $minQuantity); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { echo "<h1>Products with Minimum Quantity in Stock</h1>"; echo "<table border='1'>"; echo "<tr><th>Product Code</th><th>Product Name</th><th>Quantity in Stock</th></tr>"; while($row = $result->fetch_assoc()) { echo "<tr>"; echo "<td>" . $row["product_code"] . "</td>"; echo "<td>" . $row["product_name"] . "</td>"; echo "<td>" . $row["quantity_in_stock"] . "</td>"; echo "</tr>"; } echo "</table>"; } else { echo "<h1>No products found with the specified minimum quantity in stock.</h1>"; } $stmt->close(); $conn->close(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Form</title> </head> <body> <h1>form</h1> <form action="form.php" method="post"> <p>Minimum stock quantity: <input type="text" name="minimum" id="minimum"></p> <p><input type="submit"> </form> </body> </html> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 1.145.122.183) ---- Manual Page -- https://php.net/manual/en/reserved.variables.server.php Edit -- https://main.php.net/note/edit/129562 Del: integrated -- https://main.php.net/note/delete/129562/integrated Del: useless -- https://main.php.net/note/delete/129562/useless Del: bad code -- https://main.php.net/note/delete/129562/bad+code Del: spam -- https://main.php.net/note/delete/129562/spam Del: non-english -- https://main.php.net/note/delete/129562/non-english Del: in docs -- https://main.php.net/note/delete/129562/in+docs Del: other reasons-- https://main.php.net/note/delete/129562 Reject -- https://main.php.net/note/reject/129562 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221364) next »