I am trying to add the values of the below prepared statement to array (as I will use this array later in another prepared statement). but the result when I echo the array is "Array" without any values.
What is missing?
the php code:
<?php
$mysqli = new mysqli("x", "y", "z", "w");
$coresite = $_POST["selectedcoresite"];
$rowx = $_POST["selectedrow"];
$colx = $_POST["selectedcolumn"];
$directionx = $_POST["selecteddirection"];
$NodeID = [];
if($stmt = $mysqli->prepare("SELECT DISTINCT idNode FROM NodePorts WHERE (SiteName=? AND Row=? AND Col=? AND Direction=?)"))
{
$stmt->bind_param("ssss", $coresite, $rowx, $colx, $directionx);
$stmt->execute();
$stmt->bind_result($ID);
while ($stmt->fetch())
{
array_push($NodeID, $ID);
}
$stmt->close();
}
else{
$mysqli->close();
}
echo($NodeID);
?>
var_dumpfor example to output what the array looks like. I'm not sure what you're actually wanting to do though.