xxxxxxxxxx
<?php
$x = 1;
do {
echo "The number is: $x <br>";
$x++;
} while ($x <= 5);
?>
xxxxxxxxxx
<?php
include '../config/config.inc';
$sql = "SELECT TOP(1) * FROM assembly_armatureassy_tbl";
$data = array();
$query = mssql_query($sql);
while($result = mssql_fetch_array($query)){
$data[] = array(
'date' => $result['date'],
'shift' => $result['shift'],
'relay_type' => $result['relay_type'],
'quantity' => $result['quantity'],
'operator_name' => $result['operator_name'],
);
}
echo json_encode($data);
?>
xxxxxxxxxx
<?php
$limit = 100;
for($counter,$counter<=$limit;$counter++){
// code
}
?>
xxxxxxxxxx
// Example of a while loop in PHP
$counter = 0;
while ($counter < 5) {
echo "Value: " . $counter . "\n";
$counter++;
}