I am wondering if anyone can help. I am new to php, so apologies for my poor coding. I am trying to pull data from the database and for each lecturer I want to create a 2d array $lecturer1 [] [], lecturer2 [] [] etc and place each lecturer's id number in [0] [0]. I am a bit lost so any help would be really appreciated.
<?php
require ('mysqli_connect.php');
$lecturers_temp = array(array());
$i = 1;
$q2 = "SELECT `uninum` FROM `availabilityindex` ORDER BY `availibility`";
$result2 = @mysqli_query($dbcon,$q2);
while ($row2 = mysqli_fetch_array ($result2, MYSQLI_ASSOC)){
$lecturers = $row2['uninum'];
$lecturers_temp.$i = array(array());
$lecturers_temp.$i [0] [0] = $row2["uninum"];
$i++;
echo $lecturers_temp.$i [0] [0];
}
?>
Below is a partial answer.....but I wonder if there is anyway I could create a separate array for each person, store their uninum in [0] [0] and leave the other part of the 2d array free for other data...eventually I want to have lecturer1 (A34567 (1,0,1,0,1,0,1,0)
<?php
require ('mysqli_connect.php');
$lecturers_temp = array(array());
$i = 0;
$q2 = "SELECT `uninum` FROM `availabilityindex` ORDER BY `availibility`";
$result2 = @mysqli_query($dbcon,$q2);
while ($row2 = mysqli_fetch_array ($result2, MYSQLI_ASSOC)){
$lecturers = $row2['uninum'];
$lecturers_temp = array(array());
$lecturers_temp [$i] [0] = $row2["uninum"];
echo $lecturers_temp [$i] [0] . "<BR><BR>";
$i++;
}
?>