note 106386 deleted from language.variables.variable by danbrown
| From: | danbrown@php.net | Date: | Fri, 04 Nov 2011 13:58:04 +0000 |
| Subject: | note 106386 deleted from language.variables.variable by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184295@lists.php.net to get a copy of this message | ||
Note Submitter: info at loginetsolutions dot com
----
I was searching for a database loop example and based on info on this page I was capable to
implemented it. Hopefully it will save 5 minutes to somebody.
Here is the example:
//database connect info
......
$sql = mysql_query("SELECT containers.Container_Description, containers.Container_Order,
container_types.Container_Type_Name, container_types.Container_Size FROM containers
LEFT JOIN container_types ON containers.Container_Type = container_types.ID_Container_Type
WHERE containers.ID_Waybill ='".$_REQUEST['wno']."' ORDER BY
containers.Container_Order");
while($row = mysql_fetch_array($sql)){
${'container_size'.$row['Container_Order']} =
$row['Container_Type_Name']."-".$row['Container_Size'];
${'container_description'.$row['Container_Order']} =
$row['Container_Description'];
}
echo $container_size1." ".$container_description1."<br/>";
echo $container_size2." ".$container_description2."<br/>";
echo $container_size3." ".$container_description3."<br/>";
This will print out:
DV-20 First container
OT-20 Second container
OT-20 Third container