mysql_fetch_array

From: Date: Mon, 30 Jul 2001 19:18:19 +0000
Subject: mysql_fetch_array
Groups: php.db 
Request: Send a blank email to php-db+get-10915@lists.php.net to get a copy of this message
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 (#10915) next »