I have been working on a code to establish conenction to a database to to retrieve the information on the database. The database contains a list of names and a colour code next to them.
I have connected to the database and can pull the information but it does not limit the number of rows that is being returned (it shows all the entries).
Can anyone look at my code and help me with something that is clearly missing???!?! The FirstName entries are all unique so I only need to check the name with the color code.
<?php
$con=mysqli_connect("localhost","####","####","####");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM Members");
while($row = mysqli_fetch_array($result))
{
echo $row['FirstName'] . " " . $row['Level'];
echo "<br />";
}
mysqli_close($con);
?>
I have connected to the database and can pull the information but it does not limit the number of rows that is being returned (it shows all the entries).
Can anyone look at my code and help me with something that is clearly missing???!?! The FirstName entries are all unique so I only need to check the name with the color code.
<?php
$con=mysqli_connect("localhost","####","####","####");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM Members");
while($row = mysqli_fetch_array($result))
{
echo $row['FirstName'] . " " . $row['Level'];
echo "<br />";
}
mysqli_close($con);
?>