Here's the thing about stubbornness . . . I don't really have a choice because there are things I understand and things that I don't understand. So I have to ask questions in language that I understand, and I have to hope that someone will be kind enough to try to understand my questions and also to answer them in terms that I would understand. I don't think that's really stubbornness, although it is certainly a limitation.
Here again, although I appreciate the time you have taken, I think that I still do not have the answers to my original questions. Not, at least, in terms that I understand. Thank you anyway.
DBMS (or sometimes RDBMS) == [Relational] DataBase Management System. Most commonly we're talking about MySQL here, but it could be PostgreSQL, Oracle, MS SQL, etc.
What I'm trying to push you toward here is, instead of just trying to answer the question "I want to solve such-and-such issue by using this particular technique, but I need some help to make it work," let's just start at the top with "I want to solve such-and-such issue". To that end, I'm suggesting that you take a database-centric approach and design a database query that will return the data you want, already grouped, sorted, and averaged for you. Then there is no need to even try to figure out how to group and average the temperature readings within your PHP code.
I'm not trying to ignore your original question or give you a hard time: I want to help you to find something that approaches an optimal solution* for the task at hand, not just settle for anything that works, and help you pick up some new knowledge and skills along the way. Now, whether I'm doing a good job of explaining it at the right level for you to understand is a whole other issue, and while it's not my intent to confuse you, it's often difficult to explain some of the rather complicated issues we encounter both in simple language and without writing a 1000-word essay at the same time.
Anyway, if you choose to continue with what you have and want to do the averaging in PHP, then I need to know where the data is at the point you want to do this (in an array? in a database query result resource waiting to be be looped through? something else?) and how whatever it is is structured. Then we can figure out how to loop through it, sort it, and average it.
* remembering that if you have more than one programmer look at something, then there will me more than one optimal solution.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)