if (isset($_POST[ "submit" ])) {
$character = sanitize($_POST[ 'character' ]);
$character = mysqli_real_escape_string($db, $character);
$sql = "select user.ip FROM gamedata, user where gamedata.szName = '$character' and user.Name = gamedata.szAccountName";
$result = mysqli_query($db, $sql)
or die('There was an error running the query ['.$db -> error.']');
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
if (mysqli_num_rows($result) == 1) {
$sql2 = "select gamedata.szName FROM gamedata, user where gamedata.szAccountName = user.Name and user.ip = '".$row[ 'ip' ]."' ORDER BY gamedata.szName DESC LIMIT 100";
$result2 = $db -> query($sql2);
while ($row = mysqli_fetch_row($result2)) {
print_r($row);
}
}
I'm having an issue with getting my results to display correctly and so far the only thing I can do to get any type of results is by using print_r($row); and I'm wanting the results to display in table rows.
The script is having a person enter a character's name and then it searches by that characters username in the user database and finds their IP address. It then looks for all accounts with the same IP address and displays characters that match those usernames.
I'm sorry if this has been asked already I've been searching for hours now and I can't figure out what I'm doing wrong. Any help would be greatly appreciated.