Hey guys,
I'm having trouble with this and spent close to an hour bashing my head against the wall because I couldn't figure out how to fix this.
So help is definitely appreaciated.
Basic SQL table set up:
article_id article_cat article_title
1 0 number one
2 0 number two
3 1 number three
4 0 number four
5 0 number five
My PHP:
$cat=0;
mysql_connect("localhost", "***", "****") or die(mysql_error());
mysql_select_db("***") or die(mysql_error());
$result = mysql_query("SELECT * FROM `articles` WHERE `article_cat`=$cat ORDER BY `article_id` DESC") or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo $row['article_title'];
echo "<br />";
}
So the code gets all data with article_cat =0, in this case 5, 4, 2, 1 and displays the title.
The issue I have is that it only shows 4, 2, 1 but not 5...I'm not exactly sure what I'm doing wrong.
Thank you.