I thought about having it do a for loop and to increment the machine number so it would cover all the machines, but my question is how do I get it to pull the latest one from the datetime function at the same time.

My original idea was to have a select that ordered by datetime desc and then limited to one but that wont help with the output and would have to have me make 12 diff queries. I know theres an easier way but would like some input please. thanks

So here's the code I wrote today and when I run this, it is able to pull the machine1 info and it spits it out nicely.

I guess my question is - based off the queries, can I merge them into one maybe and then run a for loop that would increment machine and output the information there? My theory is that if I can merge all the data I query, I can then run a for loop , where $machine = 1 ; $machine <=10; $machine++; and that would run the loop 10 times and get the latest data for each machine so that its up to date. So the output would look like.

Also I would have to add a rule in my loop that if $machine = 1 , then $machine = (text name - like Zeus)
So it would show up as , Machine : Zeus instead of Machine : 1

Am I on the right path or can anyone provide constructive criticism in the way of helping me finish this out. Thanks much and its appreciated.

I also realize that I'd have to redo the query so that it wold not serch just for machine = 1, but for all machines. I would just change the limit to 10 so I'd pull the top 10 by datetime , which would be the latest 10 to be updated (which the script would do).

SELECT (do not use * here because you have a lot of fields with the same name. if you wanted to specify a field from a certain table just use the alias as the prefix ie hd.machine)FROMhard_drive hdINNER JOINmemory m ON hd.machine = m.machineINNER JOINload l ON hd.machine = l.machineWHERE (you may not need this and if you use it, it may return only one row)hd.machine = XXX

but to use the assocative array, you need to should create aliases in your select statementselect hd.available AS hdAvail and then use that alias hdAvail as the key in the array - $row['hdAvail'] if you're having trouble at this point, inside the for loop, just print_r($row) and see what it gives you