I have an issue, I'm looping threw a set of values and then creating a PDO mySql query with every loop, now the problem is the first query is executing and returning results, but the second upwards aren't returning results. If I manually execute the queries on the server they return results. This is weird, maybe I'm doing something wrong here. My code below
if($num_results > 0){ for($i=0;$i<$num_results;$i++){ $sql_sub = "SELECT * FROM menu_config WHERE client_id =".$client_id ." AND id =".$data[$i]['root_menu_id']; $results_s = $pdo->query($sql_sub); $data_s = $results_s->fetchAll(PDO::FETCH_ASSOC); $sub_menu_title = "<strong>".$data[$i]['title']."</strong>"; if(empty($data_s[0]['title'])){ $main_menu_title = '<span style="color:#FF0000;font-weight:bold;">No Main Menu Assigned to Sub Menu</span>'; }else{ $main_menu_title = $data_s[0]['title']; } $men_title = $data[$i]['title'] } }
$main_menu_titleand$men_titleonly with last iteration of your for statement?$row = $pdo->query($sql_sub)->fetch();and thenprint_r($row)