Basically I pull the identifier from table1, use this identifier to find the site identifier in table2, then I need to use the site identifiers in the array, implode and query table3 for the site names. I cannot blow the array correctly, first I got an error and then used a while loop.
In a while loop, the output simply says: Array
$mysqli = mysqli_connect("server", "login", "pass", "db");
$sql = "SELECT MarketID FROM marketdates WHERE Date = '2010-04-04 00:00:00' AND VenueID = '2'";
$result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
$dates_id = mysqli_fetch_assoc ( $result );
$comma_separated = implode(",", $dates_id);
echo $comma_separated;
$sql = "SELECT SIteID FROM bookings WHERE BSH_ID = '1' AND MarketID = '$comma_separated'";
$result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
$SIteID = array();
while ($newArray = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
$SIteID[] = $newArray[SIteID];
}
$locationList = implode(",",$SIteID);
?>
Basically, what I need to do is correctly move the query results to an array, which I can decouple and use in the third query to pull the names from the table3.
source
share