我已经能够使用表下方的代码从此表中获取多个详细信息......
我知道该表看起来很奇怪,但这是客户端提供的可用数据表。
id | class | gender | e1 | e2 | d1 | d2
----------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | class1 | male | ,first, first, first | ,first, first, first | , 2019-12-24,2019-12-24,2019-12-24 | ,2019-12-04,2019-11-21,2019-11-20 |
2 | class2 | female | ,second, second, second | ,second, second, second | ,2019-12-04,2019-11-21,2019-11-20 | , 2019-12-20,2019-12-20,2019-12-20
3 | class3 | male | ,first, first, first | ,third, third, third | ,2019-12-06,2019-12-13,2019-12-19 | ,2019-12-06,2019-12-13,2019-12-19
4 | class4 | male | ,third, third, third | ,third, third, third | ,2019-12-20,2019-12-20,2019-12-20 | ,2019-12-24,2019-12-24,2019-12-24
5 | class5 | female | ,second, second | ,third, third, third | ,2019-12-24,2019-12-24,2019-12-24 | ,2019-12-24,2019-12-24,2019-12-24
下面是我用来获取详细信息的代码:
$datfrm ="00/00/0001";
$datto ="31/12/2099";
$gender="male";
$place_map = ['first' => 1, 'second' => 0.8, 'third' => 0.4];
//e1view
$query = "SELECT e1 FROM eyfstb WHERE gender = '$gender'";
// perform the query ...
if ($result = $db->query($query)) {
$finalScore1 = 0;
$scores="";
$last_score="";
/* fetch associative array */
while ($row = $result->fetch_assoc()) {
$efind = $row['e1'];
if (substr_count($efind, ",") >'2'){
$scores = explode(',', $row['e1']);
$last_score = trim($scores[count($scores)-1]);
$finalScore1 += $place_map[$last_score];
}
}
}
汪汪一只猫
梵蒂冈之花
慕桂英3389331
DIEA
MYYA