I have this array and I want to print it somewhere else.
I have stored it in a user.class.php but I want to print it in feedback.php.
How do I do this? Because it keeps on telling me that it doesn’t know ‘$myarray’.
Please help 🙂 Thanks.
public function getFeedback($p_iUserid) {
include("Connection.php"); //open db
try
{
$sql = "SELECT FeedbackPatient FROM tblFeedback
WHERE fk_UserId = ".$p_iUserid."";
$result = mysqli_query( $link, $sql );
while( $row=mysqli_fetch_assoc($result) )
{
$myarray[] = $row['FeedbackPatient'];
print_r($myarray);
}
mysqli_free_result( $result );
}
catch(Exception $e)
{
// no connection database
$feedback = $e->getMessage();
}
mysqli_close($link);
}
I would just make it a return of the function:
Then in
feedback.php: