Web hosting servers - 260 Part II: Developing Intranet Solutions . addResponse():

260 Part II: Developing Intranet Solutions . addResponse(): This method adds new response to the LD_RESPONSE table of the database. The attributes such as response ID, category number, subject, document ID, rate, response time, and so on are passed into an associative array as parameters to this method. It works as follows: The SQL statement is prepared using the $this->std_fields array that contains all the attributes of the LD_RESPONSE table and the values from the associative array that has been passed as parameter. The values of the parameter are formatted using the quote() method of the $this->dbi object. After executing the SQL statement, the newly added response s RESPONSE_ID is retrieved using another SQL statement. If the insertion query is successful, this method returns the response ID of the newly added response. Otherwise, it returns FALSE. Following are the other methods in this class: Method Description setResponseID() Sets the response ID. If the response ID is provided as the parameter, it is set as the object s response ID; otherwise, the current response ID is returned. getResponseSubject() Returns the subject of the current response. It takes the response ID as the parameter. getResponseDocID() Returns the document ID of the current response. It takes the response ID as the parameter. getResponder() Returns the responder of the current response. It takes response ID as the parameter. getResponseBody() Returns the body of the current response. Response ID is passed to this method as the parameter. getAvgRatingByDocID() Returns the average rating of a given document. It takes the document ID as the parameter. getTotalResponseByDocID() Returns the total number of responses for the given document. This method takes the document ID as the parameter. deleteResponse() Deletes the response from the database. It will delete all data related to the response from the database. It takes response ID as the parameter.

Leave a Reply