How to get the array string values from a function and echo them separately in a table which is located in another page?
functions.php:
function get_program()
{
$connection = db_connect();
$username = $_SESSION['username'];
$query = "SELECT * FROM utilizatori WHERE username = '$username'";
$results = mysqli_query($connection, $query);
$array = mysqli_fetch_array($results, MYSQLI_ASSOC);
return $dateOne = $array['weekOneFirst'];
return $dateTwo = $array['weekTwoFirst'];
}
index.php:
<?php require_once 'functions.php'; ?>
<div>
<?php get_program(); ?>
<table>
<tr>
<th>
Week 1
</th>
<th>
Week 2
</th>
</tr>
<tr>
<td>
<?php echo $dateOne; ?> // date 1 from array string here
</td>
<td>
<?php echo $dateTwo; ?> // date 2 from array string here
</td>
</tr>
</table>
</div>
It returns me errors:
Notice: Undefined variable: dateOne in ...
Notice: Undefined variable: dateTwo in ...