The code below shows how data from two different tables can be merged into a single array.
$command = "select * from tablename where member_id = '{$_SESSION['member_id']}'"; $result = mysqli_query($db, $command); while ($row = mysqli_fetch_assoc($result)) { $my_array['id'] = $row['id']; $my_array['title'] = $row['mytext']; $my_array['title'] = date("ga", strtotime($row['date']))." ".substr($row['mytext'], 0, 10)."..."; $my_array['start'] = date("D, j M Y G:i:s T", strtotime($row['date'])); $my_array['color'] = '#000000'; $my_array['url'] = "filename.php?mydid=".$row['id']; $big_array[] = $my_array; } $command_b = "select * tablename2 where member_id = '{$_SESSION['member_id']}' "; $result_b = mysqli_query($db, $command_b); while ($row = mysqli_fetch_assoc($result_b)) { $my_array['id'] = $row['id']; $my_array['title'] = $row['column']; $my_array['title'] = "Note: ".substr($row['column'], 0, 10)."..."; $my_array['start'] = date("D, j M Y G:i:s T", strtotime($row['date'])); $my_array['color'] = '#dc4000'; $my_array['url'] = "filename.php?myid=".$row['id']; $big_array[] = $my_array; } print_r($big_array); ?>
© 2018 ALL Rights Reserved | Sitemap
Vancouver | North Vancouver | Burnaby | Richmond | Coquitlam | Port Coquitlam | Surrey | Langley | Maple Ridge | Mission | Abbotsford | Kamloops | Kelowna | Victoria | Squamish | Whistler | Pemberton