Jump to content

Buchead

Members
  • Posts

    59
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Buchead's Achievements

Member

Member (2/5)

1

Reputation

  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.
  6. The 3rd party app uses port 21 and nowhere can it be configured to use another port. Many thanks for your advice, it's been extremely useful.
  7. Excellent, thanks for that. But would it prevent ftp'ing of files? We don't actually have control over apache on the server so is it easy to do? Sorry for all the questions but never encountered this before.
  8. Sorry, should have said. A 3rd party app is sending data to our server to update a web shop. After the username and password would be all the product information in csv format. I need to grab this data and then process it. What I'm struggling to do is grab the data. If they pointed it at a file on our server I could process it just like a form. Whether this is the right procedure I don't know, however it's how I've used HTTP POST in the past. As this data is being pointed at any file I can't see how to grab it. Hopefully this makes a little more sense now!
  9. Apologies if this is in the wrong thread but no sure where it should have gone (if anyone can tell me I'd appreciate it). Anyway, I'm having a problem with HTTP POST. In the header no file is being specified, only the root file system. All the other times I have used this a file is specified so how can I detect the data transfer and handle the data? The header: POST / HTTP/1.0. .Accept: */*..Accept-Language: en-us..Content-Type: application/x-www-form-urlencoded..Host: thesite.co.uk Content-Length: 135 Pragma: no-cache username=user&password=password It's coming through port 21 on the server. Someone suggested putting some form of listening app on the port but then they countered it saying this would prevent any files being ftp'd to the server. Any assistance would be greatly appreciated! Thanks.
  10. Hello all, I'm having some trouble grouping some data from 3 different tables and grabbing that data based upon a value in another table. Tables: `reviews` reviewID customerID review date `routes` routeID customerID comment date `maintenance` maintenanceID customerID comment date `customers` customerID forename surname username I need to pull all the comments\review (I didn't create the tables and not been allowed to rename the fields to be either review or comment) and the customer username based by a certain customerID and ordering by the date of comment. I thought of: SELECT c.username, com.comment, com.date FROM `customers` AS c LEFT JOIN (SELECT customerID,review AS comment,date FROM `review` INNER JOIN SELECT customerID,comment,date FROM `routes` INNER JOIN SELECT customerID,comment,date FROM `maintenance`) AS com ON com.customerID=c.customerID WHERE c.customerID='1' ORDER BY com.date ASC Clearly I'm doing something obviously wrong however don't know what. Any pointers would be most appreciated. Thanks.
  11. Hi all, Wondering if someone could point out what I'm doing wrong, Have 3 tables: `states` stateID state clientID date `states_info` stateID stateText position `clients` clientID clientName `states_info` contains unique info about various states a client can be in, with position being the order they appear in. `states` list can contain multiple entries for a client detailing the state they were in and the date. What I'd like to do is pull out a count of the number of clients in each state. If I use: SELECT COUNT(s.clientID) AS noClients, st.state, st.stateID FROM `states_info` AS st LEFT JOIN `states` AS s ON st.stateID=s.state GROUP BY st.stateID ORDER BY st.position ASC it will produce a count, however includes all clients that have been in a state. What I'd like it to only include the latest state (ie, `states_info` position is the highest number) a client is in. Then when I want to view a list of clients only in a certain state how I can get a list of clients in which the viewed state is the latest one (ie, the highest position number in `states_info`). SELECT c.*, si.state FROM `clients` AS c LEFT JOIN `states` AS s ON s.clientID=c.clientID LEFT JOIN `states_info` AS si ON s.state=si.stateID WHERE s.state=$value Works but not ignoring clients who are in a higher states_info position. Thanks for any pointers.
  12. Unfortunately that doesn't work as using php version 4.4.6 - and they have no plans to upgrade to 5+. Any other suggestions please?
  13. Hi all, Hopefully there isn't an obvious answer that I've completely missed. Been asked by boss to produce a page for out intranet site that pulls in an xml feed. All working ok. However he doesn't want the page written on the fly, and wants the outputted data hardcoded into the php. For some reason he can't see sense and wants to be able to view the page source and see all the data. So is it possible to grab the xml feed and pass it back into the php into an array which can be displayed? Thanks for any help, Clive.
×
×
  • 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.