Php foreach – Veri tabanından gelen veriyi yazdırmak
$query = “SELECT * FROM listings WHERE propertyID=’$propertyID'”;
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$address = $row[‘address’];
$city = $row[‘city’];
$zipcode = $row[‘zipcode’];
}
$requiredArray = array(“address” => “Street”, “city” => “City”, “zipcode” => “Zipcode”);
foreach($requiredArray as $key=>$items)
{
echo ‘<tr><th><label for=”‘.$key.'”>’.$items.'</label></th><td><input type=”text” size=”30″ value=”” name=”‘.$key.'” autocomplete=”off”></td></tr>’;
}