From 2c3600e243cf49ca851acb42597ba476d84ee288 Mon Sep 17 00:00:00 2001 From: MFox Date: Sat, 25 Mar 2017 15:33:30 -0400 Subject: [PATCH] Added Simple Database Connection --- html-ONLY-site/priv_includes/config.inc.php | 15 +++ .../priv_includes/mysqli_oo_connect.php | 20 +++ html-ONLY-site/wells-list.php | 123 ++++++++++++++++++ 3 files changed, 158 insertions(+) create mode 100644 html-ONLY-site/priv_includes/config.inc.php create mode 100644 html-ONLY-site/priv_includes/mysqli_oo_connect.php create mode 100644 html-ONLY-site/wells-list.php diff --git a/html-ONLY-site/priv_includes/config.inc.php b/html-ONLY-site/priv_includes/config.inc.php new file mode 100644 index 0000000..17b607c --- /dev/null +++ b/html-ONLY-site/priv_includes/config.inc.php @@ -0,0 +1,15 @@ + diff --git a/html-ONLY-site/priv_includes/mysqli_oo_connect.php b/html-ONLY-site/priv_includes/mysqli_oo_connect.php new file mode 100644 index 0000000..4d3e2eb --- /dev/null +++ b/html-ONLY-site/priv_includes/mysqli_oo_connect.php @@ -0,0 +1,20 @@ +connect_error) { //if there is a connection error + echo $mysqli->connect_error; //echo error to screen + unset($mysqli); //delete the object created on line 19 +} +else { //establish encoding + $mysqli->set_charset('utf8'); +} + +/* terminating php tag "?>" not needed if this file end in .php extension */ diff --git a/html-ONLY-site/wells-list.php b/html-ONLY-site/wells-list.php new file mode 100644 index 0000000..62ad138 --- /dev/null +++ b/html-ONLY-site/wells-list.php @@ -0,0 +1,123 @@ +connect_errno) { + printf("Connect failed: %s\n", $mysqli->connect_error); + exit(); +} + +$query = "SELECT Well_Street_Name FROM well_completion_report"; + +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ query($query)) { + + /* fetch associative array */ + while ($row = $result->fetch_assoc()) { + echo' + +
+
+
+

'.$row["Well_Street_Name"].'

+

short well description

+
+
+ /a>'; + //printf ($row["Well_Street_Name"]); + } + + /* free result set */ + $result->free(); + } + ?> +
+ + + + + + + + + + + + + + + + + +