I have MYSQL table:
|column1|column2|column3|
|id1 |human1 |data |
|id2 |human1 |wejkls |
|id3 |human2 |sklkls |
|id4 |human1 |sdasds |
|id5 |human2 |l;lkls |
|id6 |human3 |kkklkl |
|.......|.......|.......|
|idN |human..|.......|
So, I need to create php array:
Array {
[1] => human1
[2] => human2
[3] => human3
[N] => humanN
}
And how can I get names of persons and fill them array?
Added: Now I have this code:
$connection = new mysqli("localhost", "admin", "password", "db");
$query = "SELECT DISTINCT `teacher` FROM school_year ";
$result = mysqli_query($connection, $query);
while ($a[] = mysqli_fetch_array($result, MYSQL_NUM)) {}
print_r($a);
print_r result:
Array ( [0] => Array ( [0] => Ahmed A.A.) [1] => Array ( [0] => Scott P.P. ) [2] => Array ( [0] => ....)...
How to get names as values in array? I don't need to print names, I need them for other function.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…