MySQL Forums
Forum List  »  PHP

Re: I'm not getting all my records
Posted by: Irvin Amoraal
Date: May 08, 2015 09:48PM

It took a while, but I figured out what you saw, that I used the same command twice. So I took the first one out, and replaced the second with a "mysqli_fetch_array". It's working properly now.
Thanks.
Irvin.

// blogID, blogTitle, blogAuthor, blogImg , blogDate, blogText
$SQL = "SELECT blogID,blogTitle from blog ORDER BY blogID DESC LIMIT 5 ";
$RESULT2 = mysqli_query($conn,$SQL) or die (mysqli_error());
$row_cnt = mysqli_num_rows($RESULT2);
if($row_cnt>0){
    echo"<h3>".$row_cnt." Recent Postings</h3>";
    while ($row = mysqli_fetch_array($RESULT2)){
        echo('<br><a href="blog.php?ID='.$row[0].'">View</a>&nbsp;&nbsp;'.$row[1]);
    }
}

if($row_cnt>5){
    echo'<br><a class="readmore" href="#">more...</a><br>';
}

mysqli_free_result($RESULT2);

?>

Options: ReplyQuote


Subject
Written By
Posted
Re: I'm not getting all my records
May 08, 2015 09:48PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.