BlogPage no posts fix

This commit is contained in:
Patryk 2018-12-17 21:50:10 +01:00
parent 5143fab182
commit fb7905200b

View File

@ -101,13 +101,6 @@ if ($sql = $mysqli->prepare("SELECT * FROM user WHERE user_id =$user_id "))
<!-- /aboutwrap -->
<section id="post" name="post"></section>
<div id="postwrap">
<div class="container">
<div class="row">
<h2>NAJNOWSZE WPISY</h2>
<?php }
$sql->close();
}
@ -118,8 +111,25 @@ else die( "Błąd w zapytaniu SQL! Sprawdź kod SQL w PhpMyAdmin." );
$trash = '';
if ($sql = $mysqli->prepare("SELECT * FROM post WHERE blog_id=$user_id ORDER BY data_dodania"))
{
$sql->execute();
$checkIfHasPost = $mysqli->query("SELECT * FROM post WHERE blog_id=$user_id");
if ($checkIfHasPost) {
if($checkIfHasPost->num_rows === 0)
{?>
<section id="post" name="post"></section>
<div id="postwrap">
<div class="container">
<div class="row">
<h2>Brak Postów</h2>
<?php }
else{?>
<section id="post" name="post"></section>
<div id="postwrap">
<div class="container">
<div class="row">
<h2>Najnowsze Wpisy</h2>
<?php $sql->execute();
$sql->bind_result($post_id,$trash,$title,$description,$main,$image,$date,$mod_date);
while ($sql->fetch())
{ ?>
<div class="col-lg-4 col-md-6 col-sm-6 col-xs-12 desc">
@ -138,8 +148,10 @@ if ($sql = $mysqli->prepare("SELECT * FROM post WHERE blog_id=$user_id ORDER BY
</div> <h1> <?php echo $title; ?></h1></a>
</div>
<?php }
}
$sql->close();
}
}
else die( "Błąd w zapytaniu SQL! Sprawdź kod SQL w PhpMyAdmin." );
$mysqli->close();