hlinzi
04-14-2012, 07:43 PM
the part that doesn't work is $user = mysql_query("SELECT * FROM players WHERE name='$phpuser'"); I THINK, because i cant echo $user['zone'] or anything..
Please help :)
btw yes there are actual users in the table and stuff :D
...
$phpuser = $_SERVER['PHP_AUTH_USER'];
$user = mysql_query("SELECT * FROM players WHERE name='$phpuser'");
?>
<html>
<body>
<?php
$userzone = $user['zone'];
echo 'php user: ' . $phpuser;
$q = mysql_query("SELECT * FROM players WHERE zone='$userzone'");
while($i = mysql_fetch_array($q))
{
echo $i['name'] . " is in " . $i['zone'];
}
?>
</body>
</html>
If you're wondering what I'm doing then it's selecting a user based on htaccess authentication and then finding everyone in his zone..
Please help :)
btw yes there are actual users in the table and stuff :D
...
$phpuser = $_SERVER['PHP_AUTH_USER'];
$user = mysql_query("SELECT * FROM players WHERE name='$phpuser'");
?>
<html>
<body>
<?php
$userzone = $user['zone'];
echo 'php user: ' . $phpuser;
$q = mysql_query("SELECT * FROM players WHERE zone='$userzone'");
while($i = mysql_fetch_array($q))
{
echo $i['name'] . " is in " . $i['zone'];
}
?>
</body>
</html>
If you're wondering what I'm doing then it's selecting a user based on htaccess authentication and then finding everyone in his zone..