davehaz
06-25-2005, 02:00 PM
hello, I am trying to create an array from data read from a db. I am using the following code.
foreach ($multimls as $key => $mls){
$sql= "SELECT * FROM listings WHERE mls = '$mls'";
$result = mysql_query($sql);
if (!$result) {
die('Invalid query: ' . mysql_error());
}else
while ($line = mysql_fetch_assoc($result)) {
$_SESSION['lockbox'] = $line['lockbox'];
$_SESSION['occupant'] = $line['occupancy'];
$_SESSION['directions'] = $line['directions'];
$_SESSION['combo'] = $line['combo'];
$_SESSION['showinginst'] = $line['showinginst'];
$_SESSION['stnum'] = $line['stnum'];
$_SESSION['stname']= $line['stname'];
$tempadx = $_SESSION['stnum']." ".$_SESSION['stname'];
$adx = array($tempadx);
}}
the $adx = array($tempadx); is where I think I am having the problem, I have tried using $adx = array(1,$tempadx); but when I echo out $adx, I get a 1 and then the adx.
thanks.
foreach ($multimls as $key => $mls){
$sql= "SELECT * FROM listings WHERE mls = '$mls'";
$result = mysql_query($sql);
if (!$result) {
die('Invalid query: ' . mysql_error());
}else
while ($line = mysql_fetch_assoc($result)) {
$_SESSION['lockbox'] = $line['lockbox'];
$_SESSION['occupant'] = $line['occupancy'];
$_SESSION['directions'] = $line['directions'];
$_SESSION['combo'] = $line['combo'];
$_SESSION['showinginst'] = $line['showinginst'];
$_SESSION['stnum'] = $line['stnum'];
$_SESSION['stname']= $line['stname'];
$tempadx = $_SESSION['stnum']." ".$_SESSION['stname'];
$adx = array($tempadx);
}}
the $adx = array($tempadx); is where I think I am having the problem, I have tried using $adx = array(1,$tempadx); but when I echo out $adx, I get a 1 and then the adx.
thanks.