PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am new to PHP and I am having a small problem and I hope someone can help me with this. OK here is my problem and I am sure someone will see the wickedness of my bad coding.
When I run the code below it does return a result but not the one I want. Instead of returning the row with a status of 1 it is returning the row with the status of 0. What am I doing wrong?
if($row['status']=1) is an assignment. It is setting the value of $row['status'] to 1, and then if it was able to do so, continues down into the IF statement. Use == (double equals) to check for a value: if($row['status'] == 1)
Thanks ... for helping. I did what you said now when I run it nothing appears at all. Not even an error message.
Basically what I am trying to do is be able to have a "news" script that will only post active stories. In the data base there is a field for the status of each story. 1 being active and 0 being inactive. What I want is for the script to loop through the table and pull only the stories with a "1" in the status field.
Currently I have two test entries in the database. One with the status of "1" and the other with the status of "0" maybe I am being an idiot and the answer is right in front of my nose. BUt I can't see it.