connect_errno > 0){ die ('Unable to connect to database [' . $db->connect_errno . ']'); } #$sql = "SELECT * FROM `history` WHERE `charname` = '$cnameid' ORDER BY `historydate` ASC"; //old sql statement that works currently #$sql = "SELECT history.*, treasurelocation.* FROM history LEFT OUTER JOIN treasurelocation ON history.`locationid` = treasurelocation.`treasureid` WHERE history.`charname` = '$cnameid' ORDER BY `historydate` ASC"; //round 2 of SQL queries, saving this since it still works $sql = "SELECT history.*, treasurelocation.*, playername.`playerid`, playername.`charname` FROM ((history INNER JOIN treasurelocation ON history.`locationid` = treasurelocation.`treasureid`) INNER JOIN playername ON history.`charnameid` = playername.`playerid`) WHERE history.`charnameid` = '$cnameid' ORDER BY `historydate` ASC"; if (!$result = $con->query($sql)){ die ('There was an error running the query [' . $con->error . ']'); } if (mysqli_num_rows($result) > 0) { while ($row = $result->fetch_array()){ echo 'On ' . $row['historydate'] . ', "' . $row['charname'] . '" got ' . $row['goldrec'] . 'GP and '; if ($row['itemtype'] == "Rune") { echo 'a ' . $row['itemtype'] . ' of ' . $row['runetype']; } else { if (is_null($row['material'])) { echo 'a ' . $row['itemrarity'] . ' r' . $row['itemreq'] . ' ' . $row['itemattribute'] . ' ' . $row['itemtype'] . ' named something stupid'; } else { echo 'a ' . $row['material']; } } echo ' at ' . $row['location'] . '
'; } } else { echo 'There is no data to display for that character yet'; } ?>
Return to character selection page