// Establish a connection to the database $connection = mysqli_connect('localhost', 'username', 'password', 'database'); // Define the search criteria $search = '1234'; // search for orders with ID of 1234 // Formulate the SQL query $sql_query = "SELECT * FROM orders WHERE order_id = '{$search}'"; // Execute the query and retrieve the results $results = mysqli_query($connection, $sql_query); // Loop through the results and display them while ($row = mysqli_fetch_assoc($results)) { echo "Order ID: " . $row['order_id'] . "In this example, we are searching for all orders with an ID of 1234 in the database table named "orders". We formulate the SQL query to retrieve the data and execute it using the mysqli_query() function. Then, we loop through the results using a while loop and display the relevant information. The package library used in this example is the MySQLi extension, which provides a procedural interface for accessing MySQL databases in PHP.
"; echo "Total Amount: $" . $row['total_amount'] . "
"; echo "Order Date: " . $row['order_date'] . "
"; }