gpt4 book ai didi

php - 警告: odbc_fetch_row(): 4 is not a valid ODBC result错误

转载 作者:行者123 更新时间:2023-12-03 08:57:37 24 4
gpt4 key购买 nike

我正在做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);

在“很多事情”中,y调用另一个具有此查询的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

最佳答案

It finishes the first iteration and it does it well... but when he has to do the second one i get this error:



这表明 while循环中的某些代码行正在破坏结果变量 $rss(或可能是 $rs,具体取决于哪个 odbc_fetch_row()调用失败)。仔细检查代码,以确保您不会在循环内无意中将值分配给结果变量。

关于php - 警告: odbc_fetch_row(): 4 is not a valid ODBC result错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19305446/

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