php - Selecting array of unique results from database and using them foreach -
i'm trying array of unique rows database , use them in foreach dropdown menu, have never ever touched arrays or foreach function. thought getting it, code doesn't seem work. couldn't find on site or web on subject turn help. in advance.
<select name='item'> <?php $getitems = $data->query('select * items id != "'.$sellid.'"'); while($row = $getitems->fetch_assoc()) { $getitems_2 = $data->query('select * inventory itemid = "'.$row['id'].'"'); $raw = $getitems_2->fetch_assoc(); $raw = array_unique($raw['itemid'])); foreach ($raw $value) { echo "<option value='".$value."'>".$row['name']."</option>"; } } ?>
Comments
Post a Comment