ID:               16777
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Feedback
 Bug Type:         ODBC related
 Operating System: win 2000
 PHP Version:      4.2.0
 New Comment:

Can you please provide a simplified test case that doesn't work for
you?


Previous Comments:
------------------------------------------------------------------------

[2002-04-23 19:52:33] [EMAIL PROTECTED]

I would like to apologize, for I have uninstalled 4.2 from my server
and went back to 4.1, and now I do not have the complete error
messages.

Server: Windows 2000 IIS
SQL server 2k
PHP ver 4.2
odbc 

Problem: Old scripts that ran fine on version 4.1.2 now give error
messages stating that the odbc connection is in use "SQLstate S1000
waiting for result from previous hstmnt"

We have scoured the INI, tried the old ini as well. same results. I put
4.1.2 back on, issue is gone. 

I am running into this issue when looping through the Db and running a
subloop inside based off results from the first loop. I do this with
functions inside a loop as well as actually running a new while loop
inside of the first one. I have tried altering my code, making sure i
have closed all db connections (which i never do) and free allodbc
results from memory.

sample codes:

here are the defined functions:
function countapproved ($project_id){
        $time = date ("H:i");
        $date = date("m/d/y");
        $cto_f = odbc_connect("emp1","","")
         or die("Error Connecting To CDBMS.");
        $cnt_rec = ("select count (*) from [cto_main] where emp_pro
='$project_id' and date = '$date' and pref_time < '$time' and
cto_status_id <> '2' and cto_status_id <> '3' and (shift_time >
'$time')");
        $ex_cr = odbc_exec($cto_f,$cnt_rec);
        $count = odbc_result($ex_cr, 1);
        return $count;
}

function countgranted ($project_id){
        $time = date ("H:i");
        $date = date("m/d/y");
        $cto_f = odbc_connect("emp1","","")
         or die("Error Connecting To CDBMS.");
        $cnt_rec = ("select count (*) from [cto_main] where emp_pro
='$project_id' and date = '$date' and cto_status_id = '2'");
        $ex_cr = odbc_exec($cto_f,$cnt_rec);
        $count = odbc_result($ex_cr, 1);
        return $count;
}

function countsignedout ($project_id){
        $time = date ("H:i");
        $date = date("m/d/y");
        $cto_f = odbc_connect("emp1","","")
         or die("Error Connecting To CDBMS.");
        $cnt_rec = ("select count (*) from [cto_main] where (emp_pro
='$project_id') and (date = '$date') and cto_status_id = '3'");
        $ex_cr = odbc_exec($cto_f,$cnt_rec);
        $count = odbc_result($ex_cr, 1);
        return $count;
}

function countpending ($project_id){
        $time = date ("H:i");
        $date = date("m/d/y");
        $cto_f = odbc_connect("emp1","","")
         or die("Error Connecting To CDBMS.");
        $cnt_rec = ("select count (*) from [cto_main] where emp_pro
='$project_id' and date = '$date' and pref_time > '$time' and
cto_status_id <> '2' and cto_status_id <> '3' and (shift_time >
'$time')");
        $ex_cr = odbc_exec($cto_f,$cnt_rec);
        $count = odbc_result($ex_cr, 1);
        return $count;
}

running inside this loop:



$get_cto_pro= ("SELECT     *, project.project_name FROM cto_project
INNER JOIN project ON cto_project.cto_project_id = project.project_id
order by project_name");
                                $ex_cp = odbc_exec($cto,$get_cto_pro);
                                $row = 0;
                                        while( odbc_fetch_row( $ex_cp ) ) { 
                                                 $row++;
                                                 $p_name= odbc_result( $ex_cp, 
'project_name' );
                                                 $project_id= odbc_result( $ex_cp, 
'cto_project_id' );
                                                
                                                 $total_appr = countapproved 
($project_id);
                                                 $total_granted = countgranted 
($project_id);
                                                 $total_s_o = countsignedout 
($project_id);
                                                 $total_pend = countpending 
($project_id);
                                                 
                                                 $total = $total_appr + $total_granted 
+ $total_s_o +
$total_pend;
                                                
                                                 print ("<tr><td><a
href=\"queue.php?p_name=$p_name&project_id=$project_id\">$p_name</td><td
bgcolor=ffffff><center>$total</center></td><td
bgcolor=ffffff><center>$total_appr</center></td><td
bgcolor=ffffff><center>$total_pend</center></td><td
bgcolor=ffffff><center>$total_granted</center></td><td
bgcolor=ffffff><center>$total_s_o</center></td></tr>");


I may just be doing something wrong, but I have had very good
performance untill now. Any feedback would be appreciative.
Thanks.

Jarod Ferguson                                          

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=16777&edit=1

Reply via email to