Im trying to loop through my database and displaying every row. I don't know what is wrong with my code but it is not displaying anything at all... Can anyone help?
<?php
$players = mysql_query("SELECT * FROM users");
while ($row = mysql_fetch_assoc($players)) {
$steamid = $row["name"];
$profilename = $row["profilename"];
$profileurl = $row["profileurl"];
$avatar = $row["avatar"];
$region = $row["region"];
?>
<p><?php echo $name ?></p>
<p>><?php echo $profilename ?></p>
<p>><?php echo $profileurl ?></p>
<p><?php echo $avatar ?></p>
<?php
}
?>
This is where im including this file:
<?php include 'fetch_players.php'; ?>
$nameis not defined but that should only throw a warning (incorrect assigning here possibly$steamid = $row["name"];). Do you have a database connection?mysql_*usemysqli_*orPDOmysql_query(...) or die(mysql_error())should be the absolute barebones/minimum acceptable error handling. and even then, you shouldn't be using the mysql_*() functions anymore. they're dead/gone and should be avoided at all costs.