<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://ift.tt/1P3hXG4">
<script src="http://ift.tt/1JJRCNi"></script>
<link rel="stylesheet" href="http://ift.tt/1I7E37E">
</head>
<body>
<!-- Always shows a header, even in smaller screens. -->
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
<header class="mdl-layout__header">
<div class="mdl-layout__header-row">
<!-- Title -->
<span class="mdl-layout-title">Forum</span>
<!-- Add spacer, to align navigation to the right -->
<div class="mdl-layout-spacer"></div>
<!-- Navigation. We hide it in small screens. -->
<nav class="mdl-navigation mdl-layout--large-screen-only">
<a class="mdl-navigation__link" href="">Default Subforum2</a>
</nav>
</div>
</header>
<div class="mdl-layout__drawer">
<span class="mdl-layout-title">Forum</span>
<nav class="mdl-navigation">
<a class="mdl-navigation__link" href="">Browse Subforums</a>
<a class="mdl-navigation__link" href="">Search For Post</a>
</nav>
</div>
<main class="mdl-layout__content">
<div class="page-content">
<!-- Your content goes here -->
<?php
include("dbforforum.php");
$subForum = "";
$results = $mysqli->query("SELECT * FROM `SubForumList`");
echo $results;
for ($i = 0; $i < $results->num_rows; $i++)
{
$results->data_seek($i);
$row = $results->fetch_assoc();
$subForum = $row['Name'];
echo $subForum;
echo $subForum;
}
?>
</div>
</main>
</div>
</body>
</html>
I'm trying to echo HTML within PHP the row 'subForum' of my SQL table $row['subForum'] every time this loop goes through, however, for some reason it is not connecting.
Even in dbforforum.php, my database config file, it is showing that it connected successfully:
<?php
$mysqli = new mysqli("localhost", "root", "", "Forum");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
I am very, very confused by this. Any help is appreciated.
Note: I recently switched to Mac from Windows (not my choice), and have therefore gone from WAMP to MAMP. Not sure if this has to do with anything.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire