Problem with foreach
Posted: Wed Aug 25, 2004 2:16 pm
Hi all
I have problem with thois script
Don't know how to connect these two, and I get parse error on line
foreach($sifra as $sif & $opts as $opt)
$shif should be ID of record, and $opt should be name of record
Please help
I have problem with thois script
Code: Select all
<?php
$sql = "select * from apartmani where iznajmljivac = '$broj' order by vrsta_smjestaja";
$opts = array();
$sifra = array();
$res = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($res)){
$opts[] = $row['vrsta_smjestaja'] . " - " . $row['Naziv_objekta'];
$sifra[] = $row['Sifra_apartmana'];
}
?>
<select name="drugi_smjestaj" onChange="MM_jumpMenu('parent',this,0)" class="txt">
<?php
foreach($sifra as $sif & $opts as $opt){
echo '<option value="http://localhost/plavi/hr/preview_app.php?Sifra_apartmana='.$sif.'">'.$opt.'</option>';
}
include("disconect.php");
?>
<?php
?>foreach($sifra as $sif & $opts as $opt)
$shif should be ID of record, and $opt should be name of record
Please help