我正在做 2 个查询
CALCULA_DEPARTAMENTO.PHP
$consulta= "SELECT * FROM Dept INNER JOIN Userinfo
ON Userinfo.Deptid = Dept.Deptid
where Dept.DeptName = '$departamento'";
有了这个,我选择了一个部门的所有人。然后我会确保它有效
$rs=odbc_exec($conn,$consulta);
if (!$rs)
{exit("Connection Failed: " . $rs);}
然后检查所有结果我这样做:
while (odbc_fetch_row($rs))
{
session_start();
ob_start();
$_SESSION['departamento'] = $departamento;
include_once("calcula_cono.php");
calcularr();
}
odbc_close($conn);
在“很多事情”中,您调用另一个具有此查询的 php,以便能够查看一个人的所有来龙去脉:
CALCULA_CONO.PHP
function calcularr()
{
$departamento = $_SESSION['departamento'];
$consultaa = "SELECT * FROM Checkinout, Userinfo
where Checkinout.Userid = '$userid' AND
Userinfo.userid = '$userid' AND
Checkinout.Checktime BETWEEN CDate('$fecha_inicio') AND
CDate('$fecha_fin')";
$rss=odbc_exec($conn,$consultaa);
if (!$rss)
{exit("Connection Failed: " . $rss);}
while (odbc_fetch_row($rss))
{ //more things here
}
}
它完成了第一次迭代并且做得很好......但是当他必须进行第二次迭代时,我得到了这个错误:
Warning: odbc_fetch_row(): 4 is not a valid ODBC result resource