From def419eae0d192d22d8e87b92f8f96865a7811f0 Mon Sep 17 00:00:00 2001 From: Sorrel Harriet <s.harriet@gold.ac.uk> Date: Fri, 4 Nov 2016 17:01:00 +0000 Subject: [PATCH] updating vending machine without my db deets --- lab-5/vending-machine/index.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lab-5/vending-machine/index.php b/lab-5/vending-machine/index.php index 843df65..bcdc3a6 100755 --- a/lab-5/vending-machine/index.php +++ b/lab-5/vending-machine/index.php @@ -4,9 +4,9 @@ // define a connection 'handle' $link = mysqli_connect( 'localhost', - 'sharr003', - 'password123', - 'sharr003_vendingmachine' + 'USERNAME', + 'PASSWORD', + 'DATABASE_NAME' ); // check connection succeeded @@ -18,7 +18,7 @@ if (mysqli_connect_errno()) { $content = "<h1>Hot Drinks Menu</h1>"; // define the SQL query to run -$sql = "SELECT name, code, price FROM DrinkOption ORDER BY code"; +$sql = "SELECT drink_name, code, price FROM DrinkOption ORDER BY code"; // fetch records as a result-set $result = mysqli_query($link, $sql); @@ -32,7 +32,7 @@ if ($result === false) { // fetch associative array while ($row = mysqli_fetch_assoc($result)) { $content .= "<tr> - <td>".$row['name']."</td> + <td>".$row['drink_name']."</td> <td>".$row['code']."</td> <td> £".$row['price']."</td> </tr>"; -- GitLab