Suppose I am executing several queries on the server using mysql_query
. The results of every query affect the subsequent query. Will every call of mysql_query
be completely executed before control moves on to the next one?
Edit: I forgot to mention, I am not using a transactional storage engine.
mysql_query() sends a query to the currently active database on the server that's associated with the specified link identifier. If link_identifier isn't specified, the last opened link is assumed. If no link is open, the function tries to establish a link as if mysql_connect() was called with no arguments, and use it.
This extension was deprecated in PHP 5.5. 0, and it was removed in PHP 7.0.
mysql_query() returns TRUE (non-zero) or FALSE to indicate whether or not the query succeeded. A return value of TRUE means that the query was legal and could be executed by the server. It does not indicate anything about the number of rows affected or returned.
Definition and Usage. The mysqli_query() function accepts a string value representing a query as one of the parameters and, executes/performs the given query on the database.
Yes, the MySQL server must return data and complete the query before PHP will progress to the next action, be it assigning the return value or progressing to the next line of code.
mysql_query( "INSERT INTO y VALUES (x,1)" );
mysql_query( "SELECT x FROM y WHERE z=1" );
mysql_query( "UPDATE y SET x=x+1 WHERE z=1" );
mysql_query( "SELECT x FROM y WHERE z=1" );
x will be 1, then 2, and by the time of the fourth statement 2 will be returned to the script. It is not possible to run the queries in parallel in a single PHP script - this would require parallel execution or threading in another language (i.e. Java).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With