I am having trouble looping the mysql data with html for a limited amount of rows. I need the echo the initial div's in the html to display the initial html containers that do not need to be looped. After, I want to loop the first 4 rows returned along with its html block. I am coming up with an empty page. It is not displaying the 4 rows with the mysql data.
function functionName(){
$DBvar = new mysqli($Serv,$use,$pass,$db);
/* Checking Connection */
if($DBvar->connect_errno) {
printf("Connection Failed: %s \n",$DBvar->connect_error);
exit();
}
if($response = $DBvar->query("SELECT * FROM Table1 ORDER BY 'ColunmName' DESC LIMIT 0,4")) {
echo "<div class=\"row\">
<div class=\"span12\">
<div class=\"recent-posts\"><br>";
while($obj = $response->fetch_object()) {
$id = $obj['id'];
$clmn1= $obj['clmn1'];
$clmn2= $obj['clmn2'];
$clmn3= $obj['clmn3'];
printf("<div class=\"span3 border-hover\" id=\"id%s\">
<article>
<h5><a rel=\"nofollow\"><strong>%s</strong></a></h5>
%s
</article>
<p>%s</p>
</div>", $id, $clmn1, $clmn2, $clmn3);
}
echo "
</div>
</div>
</div>";
}
$response->close();
}