';
echo '
Meme Machine
';
$dir = "../uploads"; // Directory for file uploads
$fileType = array( // Types of files that are thumbnail'd
'jpg',
'jpeg',
'png',
'gif'
);
// MySQL server connection info
$servername = "db_address";
$username = "db_username";
$password = "db_password";
$dbname = "db_name";
$count = 0;
//Connect to MySQL
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die ("CONNECTION FAIL " .mysqli_connect_error());
} else {
}
if(isset($_POST["browse"]) && $var) { // If "Browse" is pressed
echo '
Category: ' . $_POST["memeCategory"] . '
';
$memeCategory = mysqli_real_escape_string($conn, $_POST["memeCategory"]);
$browse = "SELECT * FROM memes WHERE category = \"$memeCategory\"";
$result = mysqli_query($conn, $browse);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
$count++;
echo '

';
if ($count == 3) {
echo '
';
}
}
} else {
echo "This category is empty. Please choose another or start uploading";
?>
Back
Category: all';
$browse = "SELECT * FROM memes";
$result = mysqli_query($conn, $browse);
//browse all code goes here
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
$count++;
echo '

';
if ($count == 3) { // Change this number based on how many pictures across you want on the page
echo '
';
}
}
} else {
echo "Shit, something broke. Try again! Or if the problem persists contact the system administrator";
?>
Back
';
echo '';
?>