我在数据库中有3个字段
Total_Points
Earned_Point
Progress
Run Code Online (Sandbox Code Playgroud)
让我们说这是一场比赛
我从1000点获得了800点
Total_Points = 1000
Earned_Point = 800
Progress = 80%
Run Code Online (Sandbox Code Playgroud)
我手动计算进度((80%))
如何使用PHP自动计算?
要%自动获取?
我用jquery + css3创建手风琴菜单一切正常,期待菜单总是打开页面加载和隐藏它不起作用的代码这是我创建的小提琴
这是我的jquery代码
$(document).ready(function() {
//ACCORDION BUTTON ACTION (ON CLICK DO THE FOLLOWING)
$('.zero_menu_title_collapse').click(function() {
//REMOVE THE ON CLASS FROM ALL BUTTONS
$('.zero_menu_title_collapse').removeClass('on');
//NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
$('.zero_menu_content').slideUp('normal');
//IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
if($(this).next().is(':hidden') == true) {
//ADD THE ON CLASS TO THE BUTTON
$(this).addClass('on');
//OPEN THE SLIDE
$(this).next().slideDown('normal');
}
});
/*** REMOVE IF MOUSEOVER IS NOT REQUIRED ***/
//ADDS THE .OVER CLASS FROM THE STYLESHEET ON MOUSEOVER
$('.').mouseover(function() {
$(this).addClass('over'); …Run Code Online (Sandbox Code Playgroud) 我是初学者.我有两个问题.
这是我的查询:
$result = mysql_query( "select SUM(achievenum) as achieve_rows from games" );
$row = mysql_fetch_object( $result );
$total_achieve = $row->achieve_rows;
$result = mysql_query( "select SUM(achieveget) as get_rows from games" );
$row = mysql_fetch_object( $result );
$get_achieve = $row->get_rows;
$completed_rate = $get_achieve * 100 / $total_achieve;
Run Code Online (Sandbox Code Playgroud)
如何使用一个查询而不是两个查询来创建此代码?
当我显示百分比
表明
Completion Rate : 32.3529411765%
Run Code Online (Sandbox Code Playgroud)
我需要它只显示前三个数字.
32.3 %
Run Code Online (Sandbox Code Playgroud)