Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ifrah Shahid
lab-exercises
Commits
def419ea
Commit
def419ea
authored
Nov 04, 2016
by
Sorrel Harriet
Browse files
updating vending machine without my db deets
parent
38dc044f
Changes
1
Hide whitespace changes
Inline
Side-by-side
lab-5/vending-machine/index.php
View file @
def419ea
...
...
@@ -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>"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment