我正在使用数据表来列出我的数据。它以与数据库表中相同的顺序显示我的数据。但我想以不同的顺序展示它。我的代码:
$userData = array();
$row = array();
$action = array();
foreach ($students as $key => $student) {
foreach ($student as $key => $value) {
switch ($key) {
case 'firstName' :
$firstName = $value;
break;
case 'lastName' :
$lastName = $value;
$row[] = $lastName;
break;
case 'phone' :
$row[] = $value;
break;
case 'email' :
$row[] = $value;
break;
case 'studentId':
$row['DT_RowId'] = $value;
$action[] = "<a id = {$value} class = 'update'>Edit</a>  |  <a id = {$value} class = 'delete'>Delete</a> ";
}
}
$userData[] = array_merge($row, $action);
unset($row);
unset($action);
}