what would be the right way to mark item as reserved? my current way works but i doubt it's "right" way to do it.
i've a simple query to get rows from database and then outputting them inside html tags. Here is example of my php variables:
$name = $row['name'];
$price = $row['price'];
$reserved = $row['reserved'];
and html example:
<div class="container">
<div class="item">
<div class="name">
$name
</div>
<div class="price">
$price
</div>
<div class="reserved">
$reserved
</div>
</div>
</div>
if a item is reserved, then i just add text to reserved- field in database.
I hide all "reserved" divs in css. Then i'm using jquery to loop through all "reserved" items. I check if that div has text, if it has, then i show it and after that i clear it.
$(".reserved").each(function(index) {
if($(this).is(":empty")) {
$(this).hide();
}
$(this).empty();
});
After that all items which had text in "reserved" field in database will have different layout. As they're supposed to have. It works but i don't think this is the right way.. can someone lead me to the right way? any help would be appreciated.