Jump to content

Buchead

Members
  • Posts

    59
  • Joined

  • Last visited

Everything posted by Buchead

  1. I'm sure most will laugh at this but I'm new to php classes and been some code to alter that has me a little confused. I understand that to call a class function you use $object->function(). However the code I have has $object1->$object2->function(). Does this mean that within $object1 it has objects created that are written to one of it's variables? Sorry again for the stupid question, and thanks!
  2. Thank you all for the responses. After seeming some code that had exceptions where simple validations were being performed (such as checking for specific characters in a string) they threw an exception when I thought simply returning true or false would suffice. Needless to say I have soo much still to learn and understand!
  3. Apologies if this isn't the right place for this but have a query about try-catch and when to use it. Different articles I've read all say different things. Should they be used when a class object is created, whilst some articles say you should throw an exception whenever a calculation is attempted and something goes wrong (such as invalid option). On the other hand, some code I've seen pass true or false back from a calculation based upon the result. I appreciate there's no hard or fast rules and it may be down to personal preferences, but are there any rough guidelines to follow? Are there any articles or books that are worth reading that could help someone new to php5 understand it a little better. Many thanks.
  4. That worked perfectly. Thank you very much.
  5. Hi, I have a table for test results: `results` resultID year class person result What I'm attempting to do is pull out the top person from each year for a given class. I can get it pull out 1 person per year, however it's not the top result. Tried using inner queries with different join but none work. Is what I'm attempting possible or should the query be cycled through with the year specified each time? Many thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.