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!
But am thinking there must be a better way to do it? The problem that I am having is the SELECT statment and the use of foreach since it will display all results in the $query ...
This is one of the ideas I had untill I relised this problem, I know it does not work, the if statments do work ok and they are the form options.
Add the fields to be included in the output to an array. Using in_array() you can then compare the key available through foreach() of each element in the query result set.
Sorry if I was not very clear on what I am trying to do.
I want to generate a member roster for a club, BUT, the users will have the option to include or exclude items like phone numbers, e-mails, ect. (the items with the IF statements) from the output.
As for in_array() I am still new to this and just grasping a syntax of foreach(), so I am not sure how to implement it?
feyd wrote:Make sure to quote named array indices.
For example, $mysql['pn_name'] instead of $mysql[pn_name]. If you don't quote the indices, PHP will first assume you are referencing a constant, throw a notice, and then look for the key in the array.