note 84023 deleted from control-structures.while by cmb
| From: | cmb@php.net | Date: | Wed, 30 Sep 2020 11:31:09 +0000 |
| Subject: | note 84023 deleted from control-structures.while by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215486@lists.php.net to get a copy of this message | ||
Note Submitter: s dot seitz at netz-haut dot de
----
Due to the fact that php only interprets the necessary elements to get a result, I found it
convenient to concatenate different sql queries into one statement:
<?php
$q1 = 'some query on a set of tables';
$q2 = 'similar query on a another set of tables';
if ( ($r1=mysql_query($q1)) && ($r2=mysql_query($q2)) ) {
while (($row=mysql_fetch_assoc($r1))||($row=mysql_fetch_assoc($r2))) {
/* do something with $row coming from $r1 and $r2 */
}
}
?>
[EDIT BY danbrown AT php DOT net: Contains a bugfix supplied by "Ira" on 14-AUG-09 to
address an extra '(' in the leading
if statement.]