I'm not sure if the solution to this is to use variable variables or not but I just couldn't figure out how to make it work. Here's basically what I'm trying to do. I'm passing the $loop_counter into my function and I want the variables $row_cd1_questions and $result_cd1_questions to change based on the value of $loop_counter. So for instance when $loop_counter is 2 then $row_cd1_questions would become $row_cd2_questions.
function display_client_specific_questions($loop_counter){
while ($row_cd1_questions = $result_cd1_questions->fetch_object()){
do stuff...
}
}
for ($loop_counter = 1; $loop_counter <= 4; $loop_counter ++){
display_client_specific_questions($loop_counter);
}
Thanks for any assistance.