现在,我试图在如下所示的关联数组中获取值的长度。
最后,我想更改每个值的样式。
有人知道如何解决吗?
<?php
$result = mysqli_query($con, $query);
$num_rows = mysqli_num_rows($result);
$ids = array();
while ($num_rows > 0) {
$row = mysqli_fetch_array($result);
$ids[] = $row['item_id'];
$num_rows--;
}
$id = implode(', ', $ids);?>
<td><a href="success.php?id=<?php echo $id; ?>" class="btn btn-
primary">Confirm Order</a></td>
答案 0 :(得分:0)
我不确定您要做什么。你是这个意思吗?
const shopLists = [
{ genre: 'aaa', image: AAA},
{ genre: 'bb' , image: BBB},
{ genre: 'ccc', image: CCC},
{ genre: 'ddddd', image: DDD}
]
const items = shopLists.map(item => {
<Text style={item.genre === 'aaa' || item.genre === 'ccc' ? styles.shopListsGenre : styles.customStyle}>
{item.genre}
</Text>
});
{items}
const styles = StyleSheet.create({
shopListsGenre: {
paddingLeft: '33%'
},
})