Return Book_Item object: return new Function_Result(null, $item); }
Return Book_Item object: return new Function_Result(null, $item); } } The function search() returns Book_Item objects which contain $searchText in authoror title column: function search($searchText) { SELECT statement retrieves the book items which contain $searchText in author or title column: $searchStmt = “SELECT itemNo, itemType, price, title, author FROM BookShop WHERE author LIKE ‘%” . $searchText . “%’ OR title LIKE ‘% ” . $searchText . “%’” ; Call getSearchResults() function to execute the $searchStmt SQL query: $funcResult = $this->getSearchResults($searchStmt); Return the search result: return $funcResult->returnValue; } The function searchByTitle() returns Book_Item objects which contain $searchText in title column: function searchByTitle($searchText) { $searchStmt = “SELECT itemNo, itemType, price, title, author FROM BookShop WHERE title LIKE ‘% ” . $searchText . “%’” ; $funcResult = $this->getSearchResults($searchStmt); return $funcResult->returnValue; } The function searchByAuthor() returns the book items which contain $searchText in the author column: function searchByAuthor($searchText) { $searchStmt = “SELECT itemNo, itemType, price, title, author FROM BookShop WHERE author LIKE ‘% ” . $searchText . “%’” ; $funcResult = $this->getSearchResults($searchStmt); return $funcResult->returnValue; Page 566
Hint: This post is supported by Gama php5 hosting services