Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/17/2019 in all areas

  1. Assuming the "parentid" in the relations table relates to the question.id $res = $db->query("SELECT q.id , q.question , q.pageid , childid FROM question q LEFT JOIN question_relations r ON q.id = r.parentid; "); $questions = []; foreach ($res as $r) { if (!isset($questions[$r['id']])) { $questions[$r['id']] = [ 'question' => $r['question'], 'pageid' => $r['pageid'], 'relations'=> [] ]; } $questions[$r['id']]['relations'][] = $r['childid']; } $jQuestions = json_encode($questions); The resulting questions array looks like... Array ( [1] => Array ( [question] => looking for accommodation? [pageid] => 1A [relations] => Array ( [0] => 2 [1] => 3 [2] => 4 ) ) [2] => Array ( [question] => How do you pay? [pageid] => 1A1 [relations] => Array ( [0] => 3 [1] => 4 ) ) [3] => Array ( [question] => Can you stay with friends? [pageid] => 2A2 [relations] => Array ( [0] => 5 [1] => 6 ) ) ) Is that what you are trying to do?
    1 point
  2. You need to remove them from the SESSION, not just from the page display, then redisplay the list from the session data. Otherwise, when you eventually save the session data the deleted items will still be there.
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.