can someone explafind out WHY i have a query: SELECT something FROM MyTable
while ($stmt->fetch()) {
// EVERYTHING I DO HERE IS FINE
...
$ss['ss_id'] = $ss_id;
//THIS IS THE CALL I AM ASKING ABOUT
$ss['crew'] = $this->getStarshipTeam($ss_id);
}
function getStarshipTeam($starship_id) {
//THIS QUERY WORKS IN MYSQL WORKBENCH TEST
$q = "SELECT u.nome, u.cognome
FROM users u, user_props
WHERE user_props.starship_id=?
AND user_props.id_user=u.id_user
ORDER BY u.cognome ASC
";
$crew = [];
// RETURNS $stmt = false when run in the code!!! :(
if($stmt = $this->conn->prepare($q)) {
$stmt->bind_param("i", $starship_id);
$stmt->execute();
$stmt->bind_result($nome, $cognome);
while ($stmt->fetch()) {
array_push($crew, $nome." ".$cognome);
}
}
else {
die('error');
}
return $crew;
}
basically it is a fetch loop which retrieves $ss_id;
and calls the function to do the parallel query...
any hint why this happens?