Doing Checks
Posted: Sun Dec 27, 2015 12:28 am
Hey Guys,
This is my code so far was wondering if you can help me please im trying to get the below code to display no records available if there is none and if there is it will go ahead and display them?
This is my code so far was wondering if you can help me please im trying to get the below code to display no records available if there is none and if there is it will go ahead and display them?
Code: Select all
<?php
$get_posts = "select * from posts order by 1 DESC LIMIT 0,2";
$numrows = mysql_num_rows($get_posts);
$run_posts = mysql_query($get_posts);
while ($row_posts = mysql_fetch_array($run_posts)){
$post_id = $row_posts['post_id'];
$post_title = $row_posts['post_title'];
$post_image = $row_posts['post_image'];
echo "<center>
<h4><a href='details.php?post=$post_id'>$post_title</a></h4>
<img src='admin/news_images/$post_image' width='100' height='100'/></img>
</center>
";
}
?>