Conditional region based on record numbers
Posted on 2005-03-29
I'm using PHP with MySQL for a question/answer section of a website. The process is that a user will ask a question. The person answering logs into a CMS and deyermines whether or not the question should be answered or deleted. We get many repeat questions....
The simple way of determining whether the question should be displayed on the website is to see if there is any value inside the answer section. If the question hasn't been answered it simply doesn't display.
What I would like to do, however, is to have the "ask a question" section be disabled if there are 5 questions waiting to be answered. So in effect, the logic would be along the lines of:
If there are five records with blank "answer" fields, then do not display form
else display form
I'm rather rusty on PHP but I basically need a routine tthat will go through all the records and see if there are 5 records with null values in the answer field. If so, that would disable the user form. If not, the user form would appear. Make sense? Good! How do I do it?