0

I'm building this site that is connected do databases. I obviously use HTML, PHP and SQL, and have three databases: Clients, Devices and Device Records.

When I open the site, I want a table to show all the clients and the number of devices they have (this is done). Then, when I click a given client, I want a table showing all the devices from that client, and then when I click a given device (they are all unique), I want to see their records.

So, my question is: what is the best way to do this? I know I can build a page for each thing, but this will be hard if I have hundreds of clients, each having hundreds of devices. Is there a better way?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Ghelthon
  • 45
  • 1
  • 8
  • Umm, use `$_GET`? It's kinda fundamental to doing just about anything with PHP. – Quentin Oct 13 '15 at 10:43
  • @Quentin, care to explain what you mean? – Ghelthon Oct 13 '15 at 10:45
  • Probably not without writing an introductory PHP course. – Quentin Oct 13 '15 at 10:46
  • Show us the page/code you wrote for "(this is done)". – Asons Oct 13 '15 at 10:56
  • My first question would be about your database design, why are these informations on different databases if they're linked ? – Daniel Oct 13 '15 at 10:56
  • @LGSon, it is an HTML page presenting a table, that fetches information (using PHP) from a database. Daniel, a client can have multiple devices, and a device has multiple records (records = automatic measurements of some parameters). I forgot to add that this is a "live" thing, with information being automatically fed to the Records database. – Ghelthon Oct 13 '15 at 11:03
  • Ahh, so this is easy.... :) On the first page, which you do have already, when you click on a client, you pass the client id to a second page, which collects all devices that belongs to that client and put them in a new table. On the second page, when you click on a device, you pass both the client id and the device id to a third page, which collects all device records and again create a third table. Done. (This can be done using either AJAX or normal page load) – Asons Oct 13 '15 at 11:14
  • Hi @LGSon, thanks for the help! So, those would be "generic" pages, right? Can you point me to a link where I can learn more about that? I'm not very proficient using AJAX. – Ghelthon Oct 13 '15 at 11:16
  • Yepp, generic, and if you want to start with AJAX, this one show its basics, http://www.w3schools.com/ajax/, and for further reading just google for "ajax tutorial" and you saved your day with what to do :) – Asons Oct 13 '15 at 11:20

0 Answers0