Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Restaurant e-menu using html5

Posts: 4
  • Mark post as helpful
  • send pies
  • 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.
Posts: 25
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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.
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic