I am fetching rows from an Oracle table to put them into a select box but the output is not as expected. To give some context, i am querying the database to give me 4 columns of the desired rows to put each row on a single line in the drop menu but instead, i get every column of each row individually on a line. I would like to get help on how i could proceed to have each individual row with their 4 columns on a single line.
This is my oracle table from which i am retrieving data:
create table TP2_ITEM (
NO_ITEM number generated always as identity,
NO_ENCAN number(9) not null,
NO_ITEM_ENCAN_ITE number(9) not null,
TITRE_ITE varchar2(50) not null,
CHEMIN_PHOTO_ITE varchar2(200) default 'N/A',
DESC_ITE varchar2(200) default 'N/A',
DONATEUR_ITE varchar2(25) not null,
MNT_VALEUR_ITE number(8,2) not null,
MNT_PRIX_DEPART_ITE number(8,2) not null,
MNT_INCREMENT_MINI_ITE number(8,2) not null,
MNT_ACHAT_IMMEDIAT_ITE number(8,2) not null,
EST_FERME_ITE number(1) default 0,
EST_PAYE_ITE number(1) default 0,
constraint PK_ITEM primary key(NO_ITEM),
constraint FK_NO_ENCAN1 foreign key(NO_ENCAN)
references TP2_ENCAN(NO_ENCAN) on delete cascade,
constraint AK_ENCAN_ITEM unique(NO_ENCAN,NO_ITEM_ENCAN_ITE));
this is the code to fetch my rows and put them into a select box:
<?php
$stid = oci_parse($conn, "select I.NO_ITEM, NO_ITEM_ENCAN_ITE, TITRE_ITE,
MNT_VALEUR_ITE from TP2_ITEM I,TP2_ITEM_FAVORI F
where NOM_UTILISATEUR = '" .$nom_utilisateur. "'
and F.NO_ITEM = I.NO_ITEM and NO_ENCAN = '"
.implode(',', $no_encan_uti). "'";
oci_execute($stid);
echo "<select>";
while (($row = oci_fetch_array($stid, OCI_ASSOC)) != false {
foreach ($row as $item) {
echo "<option>" .$item. "</option>;
}
}
echo "</select>";
oci_free_statement($Stid);
?>
```[![Output from my program][1]][1]
P.S. I do not have any errors when i run the program but the result is not what i expect, like i described earlier.
**This is an image of the result i get with the drop menu.