Re: mysql_fetch_array

From: Date: Mon, 30 Jul 2001 19:21:13 +0000
Subject: Re: mysql_fetch_array
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10916@lists.php.net to get a copy of this message
try just changing mysql_fetch_array to mysql_fetch_assoc "Bryan" <bryan@concept-factory.com> wrote in message news:006801c1192c$649f6e30$272478cc@bryanspc... > mysql_fetch_array places 2 records for each one returned (example) > > Array > ( > [0] => 56 > [location_id] => 56 > ) > > Is there any way to delimate that and have the key present only once? > here is my code : > > /* > * > * > * Start code > * > * > */ > > while ($aRow = mysql_fetch_array($sResult) ) { > print_r($aRow); > > > foreach ($aRow as $key => $sValue) { > > $sData[$key] = "SELECT * FROM location WHERE region='$sValue' AND region > !='yes'"; > $sDataResult[$key] = mysql_query($sData[$key], $sDbcnx) or > die(mysql_error()); > > /* print Main heading linking to no where */ > > print "<OPTION > VALUE=\"#\">".$sValue."</OPTION>"; > > > while($aData[$key] = mysql_fetch_array($sDataResult[$key]) ) { > > /* grab the data from the main heading and print all the info for that > record */ > > print > "<OPTIONVALUE=\"indexes/index.php?iLoc_id=".trim($aData[$key]['location_ > > id'])."\">&nbsp;&nbsp;&nbsp;".trim($aData[$key]['location'])."</OPTION>\ > n"; > > } /* end while */ > > > } /* end foreach */ > > } /* end main while */ > > /* > * > * > * End Code > * > * > */ >

« previous php.db (#10916) next »