php-db | 2001072
Date: 07/30/01
- Next message: Steve Fitzgerald: "[PHP-DB] INSERT with a JOIN"
- Previous message: bryan: "[PHP-DB] mysql_fetch_array"
- In reply to: bryan: "[PHP-DB] mysql_fetch_array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
try just changing mysql_fetch_array to mysql_fetch_assoc
"Bryan" <bryan <email protected>> wrote in message
news:006801c1192c$649f6e30$272478cc <email protected>
> 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'])."\"> ".trim($aData[$key]['location'])."</OPTION>\
> n";
>
> } /* end while */
>
>
> } /* end foreach */
>
> } /* end main while */
>
> /*
> *
> *
> * End Code
> *
> *
> */
>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Steve Fitzgerald: "[PHP-DB] INSERT with a JOIN"
- Previous message: bryan: "[PHP-DB] mysql_fetch_array"
- In reply to: bryan: "[PHP-DB] mysql_fetch_array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

