From a649606eebd4e42b4fb210926116d5f050bd6b28 Mon Sep 17 00:00:00 2001 From: mauirixxx Date: Sat, 20 May 2017 23:40:04 -1000 Subject: [PATCH] location pre-selection code --- gw-record.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gw-record.php b/gw-record.php index b6f1e2a..f393c9f 100644 --- a/gw-record.php +++ b/gw-record.php @@ -5,13 +5,22 @@ $con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME); #$toonid = mysqli_real_escape_string($con, $_POST['playerid']); //enable this after character selection is working $toonid = 'Chrissi Chan'; #$location = mysqli_real_escape_string($con, $_POST['locationid']); //enable this after location selection is working -$location = 'Issnur Isles'; +$location = 4; if ($con->connect_errno > 0){ die ('Unable to connect to database [' . $db->connect_errno . ']'); } echo 'At '; -echo $location; //code for selecting location from DB via locationid +$sqlmaplocation = "SELECT `location`, `wikilink` FROM `treasurelocation` WHERE `treasureid` = $location"; +if (!$result = $con->query($sqlmaplocation)){ + die ('There was an error running the query [' . $con->error . ']'); +} +while ($row = $result->fetch_array()){ + $locname = $row['location']; + $loclink = $row['wikilink']; + echo '' . $locname . '\n'; +} + echo ' a/an '; //code for weapon attribute requirment @@ -19,7 +28,7 @@ $sqlweapreq = "SELECT * FROM `listreq` ORDER BY `req` ASC"; if (!$result = $con->query($sqlweapreq)){ die ('There was an error running the query [' . $con->error . ']'); } -echo ''; while ($row = $result->fetch_array()){ $reqid = $row['req']; echo '\n';