我在主查询中有一个子查询,如下所示:
$subquery = (new Query())->select('COUNT(project_sup_id)')
->from('project_supervisors AS sup')
->where(['AND','sup.project_ref_id = p.project_id']);
$uQuery =(new Query())->select(['project_id','supcount' => $subquery])
->from('projects AS p')
->join('LEFT JOIN','project_supervisors AS sup','sup.project_ref_id = project_id')
->andWhere('IF(supcount>0, sup_project_status=1, project_status=1)');
Run Code Online (Sandbox Code Playgroud)
我正在尝试根据逻辑编写 where 条件,即,如果从子查询获得的计数大于零,则 where 条件必须为sup_project_status=1else project_status=1。在普通的Mysql中,很容易在where里面写if条件,但在yii2中我不明白如何写。
我subdiv里面有div maindiv。我想将sub div分为多个行和列,如下所示。
如何划分subdiv如下

我正在尝试将值四舍五入到最高0.5值。
例如,如果我执行
select round(5.456);
Run Code Online (Sandbox Code Playgroud)
然后我想得到5.5的结果,如果执行
select round(5.73434);
Run Code Online (Sandbox Code Playgroud)
然后我想得到结果为6。
也就是说,如果值在0到0.5之间,则必须将其四舍五入;如果值在0.5到1之间,则必须将其四舍五入。
我怎样才能做到这一点?提前致谢
我有一个表格
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>
<?php echo $form->field($userformmodel, 'user_image')->fileInput(); ?>
<?= Html::submitButton('Submit', ['class' => 'btn btn-primary']) ?>
<?php ActiveForm::end(); ?>
Run Code Online (Sandbox Code Playgroud)
我正在上传表单中的文件并提交
In the model I have written the code as
public function rules()
{
return [
[['user_image'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg']
];
}
public function upload()
{
if ($this->validate()) {
$this->user_image->saveAs('uploads/' . $this->user_image->baseName . '.' . $this->user_image->extension);
return true;
} else {
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
在我的控制器中
public function actionProfile()
{ …Run Code Online (Sandbox Code Playgroud) yii2 yii2-advanced-app yii2-basic-app yii2-model yii2-validation
我在查询中给出了以下代码.
where to_date(cal_wid,'yyyymmdd')
between add_months(to_date(sysdate, 'MM-YYYY'),-12)
and to_date(sysdate, 'MM-YYYY')
Run Code Online (Sandbox Code Playgroud)
我收到以下错误.(我在Xampp服务器上做)
Warning: oci_execute(): ORA-01843: not a valid month in C:\xampp\htdocs\xxx\index.php on line 149
Warning: oci_fetch_array(): ORA-24374: define not done before fetch or execute and fetch in C:\xampp\htdocs\xxx\index.php on line 160
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我为什么会收到此错误?
我正在使用双轴高图.在y轴上,值太大而无法读取.我希望将它们转换为1000K的1K和100000的1.0L以及1000000的1.0M和35869982的35.8M以及3550977的3.5M的快捷方式.
这是我的FIDDLE
$(function () {
$('#container').highcharts({
chart: {
zoomType: 'xy'
},
title: {
text: 'Average Monthly Temperature and Rainfall in Tokyo'
},
subtitle: {
text: 'Source: WorldClimate.com'
},
xAxis: [{
categories: ['MAR-2014', 'APR-2014', 'MAY-2014', 'JUN-2014',
'JUL-2014', 'AUG-2014', 'SEP-2014', 'OCT-2014', 'NOV-2014', 'DEC-2014'],
crosshair: true
}],
yAxis: [{ // Primary yAxis
labels: {
format: '{value}',
style: {
color: Highcharts.getOptions().colors[1]
}
},
title: {
text: 'VOLUME',
style: {
color: Highcharts.getOptions().colors[1]
}
}
}, { // Secondary yAxis
title: {
text: 'REVENUE',
style: …Run Code Online (Sandbox Code Playgroud) 我引用了以下链接,仅在登录后启用注销按钮 https://stackblitz.com/edit/angular-login-hide-navbar-ngif
我只想在用户登录时在导航栏中显示“注销”,我通过从“身份验证服务”调用“this.authservice.isUserLoggedIn”并将其分配给变量并写入来验证用户是否已登录ngif“注销”链接附近的情况。我已经使用 BehaviourSubject 来获取当前状态。但我不知道为什么代码不起作用,它总是返回 false,因此即使用户登录后也不会启用“注销”链接
我有 header.component.ts
export class CommonheaderComponent implements OnInit {
constructor(private authservice : AuthenticationService) { }
isLoggedIn$ : Observable<boolean>;
ngOnInit() {
this.isLoggedIn$ = this.authservice.isUserLoggedIn;
}
}
Run Code Online (Sandbox Code Playgroud)
我有 header.component.html 如下
<ul class="nav navbar-nav">
<li><a [routerLink]='["/search"]'>Search <span class="slider"></span></a></li>
<li *ngIf="isLoggedIn"><a (click)="logout()">Logout</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
下面是login.component.ts
export class LoginComponent implements OnInit {
isLoggedIn : Observable<boolean>;
ngOnInit() {
this.isLoggedIn = this.authservice.isUserLoggedIn;
this.loginForm = this.formbuilder.group({
username : ['', Validators.required],
password : ['', Validators.required]
})
}
}
onSubmit(){
this.authservice.login(this.loginForm.value).subscribe(data => {
}) …Run Code Online (Sandbox Code Playgroud) typescript behaviorsubject angular angular-changedetection angular7
yii2 ×2
yii2-model ×2
angular ×1
angular7 ×1
css ×1
css-float ×1
css3 ×1
datatables ×1
floor ×1
highcharts ×1
html ×1
javascript ×1
jquery ×1
mysql ×1
oracle ×1
php ×1
rounding ×1
sql ×1
sysdate ×1
to-date ×1
typescript ×1
yii ×1