jeudi 2 juillet 2015

PHP foreach if else statement echo if true

I have question regarding PHP foreach loop and if else statemants or maybe in this case I need diferent aprouch?

I have tickets and each ticket have max what all people can totaly to buy.

So before I echo dropdown with tickets available, I want to check if $boutht TicketStatus < $max-user and if true I echo ticket name, if false I check next ticket for event.

Each event have many tickets so before person buys I want to check, if that ticket is available if no do not show this ticket

{
    "tickets": [
        null,
        [
            {
                "name": "soldout",
                "value": 0
            },
            {
                "name": "title",
                "value": "Workshop ar savu ekipējumu"
            },
            {
                "name": "price",
                "value": "16.00"
            },
            {
                "name": "capacity",
                "value": "20"
            },
            {
                "name": "min-user",
                "value": "10"
            },
            {
                "name": "max-user",
                "value": "20"
            },
            {
                "name": "start-time",
                "value": "2015-06-27"
            },
            {
                "name": "end-time",
                "value": "2015-07-31"
            },
            {
                "name": "link",
                "value": ""
            },
            {
                "name": "notes",
                "value": ""
            }
        ],
        [
            {
                "name": "soldout",
                "value": 0
            },
            {
                "name": "title",
                "value": "Workshop ar Talent Workshop ekipējumu"
            },
            {
                "name": "price",
                "value": "35"
            },
            {
                "name": "capacity",
                "value": "3"
            },
            {
                "name": "min-user",
                "value": "3"
            },
            {
                "name": "max-user",
                "value": "3"
            },
            {
                "name": "start-time",
                "value": "2015-06-27"
            },
            {
                "name": "end-time",
                "value": "2015-07-31"
            },
            {
                "name": "link",
                "value": ""
            },
            {
                "name": "notes",
                "value": ""
            }
        ]
    ]
}

Thanks in advance, any help would be apriciated!

Aucun commentaire:

Enregistrer un commentaire