I have a problem that is staring me in the face but I cannot seem to solve it.
First of:
1) the code is parsed prior to check for SQL injection.
2) $dbc is a reference that is part of another script that is "require_once()" called in and is working perfectly as its fine for 2 other scripts depending on it
3) the query text when pumped straight into mysql calls back exactly what Im after
4) If I put a false array into $displayBlogs, the rest of script acts as it should.
The table is populated. So why do I seem to receive no results, no errors (checked with mysqli_error($dbc) ) ? Blogs just seems to be empty.
function getSnippets()
{
// set up the query
$query1 = "SELECT * FROM blogs LIMIT 0, 10";
// action the query and save the connection
$blogs = mysqli_query($dbc, $query1);
// blank out the variable that will be used to save the query results
$displayBlogs = '';
// iterate through the query results and set up the module return
while($blog = mysqli_fetch_array($blogs))
{
$displayBlogs .= "<div class='article'><a href='" . $blog['link'] ."'>" .
"<h1>" . $blog['title'] . "</h1>" .
"<h2>" . $blog['date'] . "</h2>" .
"<p>" . $blog['body'] . "</p>" .
"</a></div>";
}
return $displayBlogs;
}