• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Restaurant e-menu using html5

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 25
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Get off me! Here, read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic