I have a standard Mysqli/php code that echo a list of items.
So lets say that a user has chosen to edit a specified product. The products is being
printet in a while loop. How do i switch content in only ex. product 9 if there is printed 100 products in a while loop?
All the products is in a Div.
Some code ex:
$query = $mysqli->query("SELECT item_name, item_id FROM items");
while($items = $query->fetch_assoc()){
echo $items['item_name'];
echo '<a href="" onclick="switch content of only the single product that has been chosen">Edit me</a>'
}
You can use a ternary operator for this: