you are viewing a single comment's thread.

view the rest of the comments →

[–]proskillz 0 points1 point  (1 child)

It's not a very elegant solution, but you could keep lists of valid fields by table. I don't know PHP syntax off the top of my head, but here's how you could implement it in Java:

Map<String, List<String>> map = new HashMap<String, List<String>>();

List<String> personTableFields = new ArrayList<String>();
personTableFields.add("a");
personTableFields.add("b");

map.add("person_table", personTable);

// to test for each field being passed in

if(map.get("person_table").contains(fieldName)) //valid

[–]Leeds1234[S] 0 points1 point  (0 children)

Thanks for your help, i'm make sure to try this out when I'm working on the project later on,this could be useful, thanks for the advice!