Here is a simple example that shows how to combine arrays with data queries from two database tables.
<?php include('connect.inc'); $db=public_db_connect(); // names from table #1 $command = "SELECT * FROM table_sort "; $result = mysqli_query($db, $command); while($row = mysqli_fetch_assoc($result)){ $firstname = $row['firstname']; $lastname = $row['lastname']; $array_list[] = $firstname."-".$lastname; } // names from table #2 $command2 = "SELECT * FROM table_sort2 "; $result2 = mysqli_query($db, $command2); while($row = mysqli_fetch_assoc($result2)){ $firstname = $row['firstname']; $lastname = $row['lastname']; $array_list[] = $firstname."-".$lastname; } // names from table #3 $command3 = "SELECT * FROM table_sort3 "; $result3 = mysqli_query($db, $command3); while($row = mysqli_fetch_assoc($result3)){ $firstname = $row['firstname']; $lastname = $row['lastname']; $array_list[] = $firstname."-".$lastname; } print_r($array_list);
© 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