My SQL structure looks like this:
ID - firstname - lastname - username - email - ect,ect,ect
I'm running this code so I can grab the entry and populate it into textboxes.
$un=$_REQUEST['un'];
$username2 = $_SESSION['username'];
if(isset($_GET['un']))
{
global $con;
$query = "SELECT * FROM users WHERE username=$un";
$result = mysqli_query($con,$query);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc())
{
$id = $row['ID'];
$stat = $row['status'];
$firstname = $row['FirstName'];
$lastname = $row['LastName'];
$username = $row['UserName'];
$email = $row['Email'];
$steamname = $row['steamname'];
$steamid = $row['SteamID64'];
$rules = $row['rules'];
$about = $row['about'];
$appnotes = $row['appnotes'];
}
}else{
}
}
else {
}
This code works fabulous when I have it set to "WHERE id=$un" or "WHERE steamid64=$un" or "WHERE steamname=$un" but the moment I set it to "WHERE username=$un" the textboxes stop populating. The only entry in my database is for username "kielly" so naturally I set my url to www.websitehere.com/page.php?un=kielly (as I would page.php?un=10 if I had it set to look for the ID instead of username).
This is one of these moments where you're both confused, amazed, and angry lol. It just doesn't make sense to me how the code works perfectly for all structure names until I go to use "username"