概述
此页面是用户选择节目下拉列表的地方,预测摘要将按照下面的屏幕截图显示“所选项目”+SelectedProgram+“的学生总数为”+学生总数+“,根据3个学期的数据预测”+城市+“的”+平均总+“学生将在下一学期入学
。”;
目前,除了+city+之外,所有功能都在工作,有最大学生人数的城市名称应该显示在那里。 我不确定如何用当前的代码添加它。 我尝试了下面的查询,但不起作用。SELECT DISTINCT student_prg
, count(student_prg) as countprg
, count(student_city) as countcity
FROM marketing_data
, current_sem
WHERE marketing_data.intake_year = current_sem.intake_year
group by student_prg
, **student_city
ORDER
by countcity desc
LIMIT 1;
选择选项代码
Select Programme
$sql = "SELECT DISTINCT student_prg, count(student_prg) as countprg, count(student_city) as countcity FROM marketing_data, current_sem WHERE marketing_data.intake_year = current_sem.intake_year group by student_prg";
$do = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($do)){
echo ''.$row['student_prg'].'';
}
?>
Javascript代码
var selectedprg = '';
var selectedcount = '';
var selectedcity = '';
var average = '';
function myFunction() {
document.getElementById("demo").innerHTML = "The total number of students in the selected program " +selectedprg + "
is " +selectedcount + " , it is predicted that " +average+ " students in " +selectedcity+ " will enroll for the upcoming semester
based on the data of 3 semesters back.";
}
$(document).ready(function(){
$("#prg").change( function(){
selectedprg = $('#prg option:selected').text();
selectedcount = $('#prg option:selected').data('count');
selectedcity = $('#prg option:selected').data('count');
if(selectedcount > 5){
average = selectedcount / 3 + 5;
} else{
average = selectedcount / 3 - 5;
}
});
});
最后
以上就是复杂小甜瓜为你收集整理的php数据库students,对student_city列PHP MySQL的查询不正确的全部内容,希望文章能够帮你解决php数据库students,对student_city列PHP MySQL的查询不正确所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复