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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.