| Author |
Restaurant e-menu using html5
|
sripadraj kudur
Greenhorn
Joined: Nov 10, 2011
Posts: 3
|
|
Hello there,
I have been using jquery mobile, html and java script lately. I'm doing a e-menu for android tablets and ipads. I have done UI's using jquery mobile elements and I need to add functionality to it and I hardly know to write complex javascripts.(but can manage with simple scripts )
I have been using php mysql to store the data like dish items, price etc in a db and i'm retrieving them using php.
I need to add the orders of the user to a seperate page and calculate the total amount of the order.
how can I do that? I need some examples which answers my questions.
Thank you.
|
 |
Kavisha Paranamana
Greenhorn
Joined: Jul 30, 2011
Posts: 15
|
|
Did you mean something like that you have (to?) all the orders fetched at the page load, and you need a separate page that shows the orders only of a particular user? If you meant that you need this to be done without having any PHP processing, you can do it by keeping a set of properties or an array of orders belong to each user. This could be something like...
I wouldn't recommend though, but you can generate the above code using a PHP foreach loop. Now, if you need to get all orders initiated by the user with the id 64, you can simply obtain them as orders['user'+userId].
However, it should be noted that this is not something you should do if you follow the good practices. This does nothing but floods the browser with excessive memory consumption, if you have thousands of users. A better idea would be having the PHP codes to yield the Order objects belong to a given user. If you use some proper kind of database caching, this approach is much better than pre-fetching everything at the first page load.
|
Kavisha Paranamana - Homepage
|
 |
 |
|
|
subject: Restaurant e-menu using html5
|
|
|