gpt4 book ai didi

javascript - php 中的计数查询

转载 作者:行者123 更新时间:2023-11-30 00:40:24 26 4
gpt4 key购买 nike

我想就 php 中的查询问题寻求一些帮助...我想做的是计算具有相同数字的所有(atic),如果特定的(atic)等于 7,我的插入查询将执行到那个(atic)。

问题是我的计数查询无法按我想要的方式工作......并对所有 aic 执行我的插入查询,即使计数不= 7。

enter image description here

当前代码:

<?php
mysql_connect("localhost","root","") or die("cant connect!");
mysql_select_db("klayton") or die("cant find database!");
$total = NULL;
$count = "SELECT count(t.atic) as '$total', t2.name FROM app_interview as t, tb_applicants as t2 WHERE t.atic = t2.aic GROUP BY t.atic";
$query = mysql_query($count) or die (mysql_error());
while($rows =mysql_fetch_array($query)){
if($query = 7){
mysql_query("INSERT INTO afnup_worksheet (faic,fnl_name,interview,fregion,ftown,funiq_id,fposition,fsalary_grade,fsalary,dateinputed) SELECT DISTINCT atic, atname,(SELECT sum(inttotal) FROM app_interview t2 WHERE t2.atic = t.atic)/7, region, town, uniq_id, position, salary_grade, salary, CURRENT_TIMESTAMP FROM app_interview t GROUP BY atname HAVING COUNT(DISTINCT atic)");
}
}
?>

最佳答案

$query = 7 表示您将值 7 赋给变量 $query

为了进行比较,您必须使用双等号==

或三个等号===表示相同的数据类型。

关于javascript - php 中的计数查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21814321/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com