$conn=mysqli_connect(“localhost”,”kurb”,”wA+r@frefE3u”,”kurbsidegaming”);
//did a connection get made if not print error
if (mysqli_connect_errno()) {
echo “Failed to connect to MySQL: ” . mysqli_connect_error();
}
else
{
$sql = “SELECT * FROM wp_games where console_id = 3 order by console_id, game_name asc”;
$result = $conn->query($sql);
if ($result->num_rows >= 1)
{
// 49 9 45 49 45 4 4 1
//record_count / 5 = var * 5 = var2 record_count – var2 = var3 5 – var3 = remaining_cells
$i = 0;
$var = intval($result->num_rows / 5);
$var = $var * 5;
$var = $result->num_rows – $var;
$var = 5 – $var;
$printed_ps3 = 0;
$html = “
while($row = $result->fetch_assoc())
{
$i = $i + 1;
if($printed_ps3 == 0)
{
//$html = $html . “
“;
$html = $html . “
$printed_ps3 = 1;
}
$html = $html . “
” . strtoupper($row[“game_name”]) . “
“;
if($i == 5)
{
$html = $html . “
“;
$html = $html . “
$i = 0;
}
}
if($var != 0)
{
for ($x=0; $x<=$var - 1; $x++) { $html = $html . "
“;
}
$html = $html . “
“;
}
$html = $html . “
“;
echo $html;
}
//connection made but not records were found
else
{
echo “Currently No Games“;
}
$conn->close();
}