Jump to content

SQL query error


Deks

Recommended Posts

Hello,

 

i have one little problem and can't pass it. Problem is i need to call new sql query inside another query. Am trying to make accordion which will put result of first query($sql) like title and result of second query($sql2) like list of current item.

All time am getting error :

 

Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt, SQL state S1000 in SQLExecDirect in .....

 

I know reasone is because i use query inside query so am trying to figure is there any way to bypass it or make it work.

 

Example:

$sql="EXECUTE _PROCEDURE1 '".$date."',''.$code.";
$rs=odbc_exec($conn,$sql);

if (!$rs){exit("Error in SQL");}

while (odbc_fetch_row($rs)){		
	$id_number=odbc_result($rs,"ID");
	$name=odbc_result($rs,"NAME");
	echo $id_number.' - '.$name;

	$sql2="EXECUTE _PROCEDURE2 '".$id_number."',''.$name.";
	$name=odbc_exec($conn,$sql2);

		while(odbc_fetch_row($popust)){ 
			$detail = odbc_result($sql2,"DETAILS");
			$detail2 = odbc_result($sql2,"DETAILS2");
			$detail3 = odbc_result($sql2,"DETAILS3");
			echo $detail.' - '.$detail2.' - '.$detail3;
}
}

 

 

I hope i explained it well.

 

Thanks.

 

Link to comment
https://forums.phpfreaks.com/topic/252203-sql-query-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.