Php sql synchronous wait

I am relatively new to web programming. Hope this is easy. I have a server application that controls an SQL table. Whenever the whole field becomes positive, the application reads the rest of the line and populates a long text field in the same record. Now I have a php script that sets the int field, and it needs to wait until the application sets the field back to zero, then reads the text field and repeats it back to the remote user. I tried this (odbc):

$processed = 0; while ( !$processed ) { $rs = odbc_exec( $conn, $sql ); odbc_fetch_row($rs); $processed = odbc_result( $rs, "Processed"); $output = odbc_result( $rs,"OutputSpec"); } 

It takes me about 5 seconds. end. Too slow. I put a counter, and it takes ~ 10,000 iterations for the "processed" changes. I know that my server application instantly changes the field. A similar result in SqlServer. Something must be holding back the fix, or something like that?

+4
source share
1 answer

you need to use the observer pattern

Use the known action to start the update.

Here are some details of the PHP implementation.

+2
source

Source: https://habr.com/ru/post/1332301/


All Articles