littlea5h Posted April 30, 2013 Share Posted April 30, 2013 So i have a car database storing parts for cars and i am in the process of creating a page which will store unique data for each car part chosen from another page(not yet created), at the moment i am just testing via the URL. This may be clear to me in the form of flat PHP but i am creating it with an MVC framework which makes it all the more complicated, i am still a noob in this area. Well the page which stores the unique data has two drop down menus for that particular part, such as the vehicle model and vehicle brand. I have created the view page, but it is the controller i am having the problems for. The other problem now is that there is way too much code for this to post here and they all connect together but im thinking if ur a PHP pro, you may have some general idea of how to go about this without looking at all the code?This is what i have for my controller so far: class CarController extends Zend_Controller_Action { public function indexAction(){ $category = new Application_Model_CarMapper(); $gcat = $this->getRequest()->getPathInfo(); //get id $id = $category->find_id_by_name($gcat); $this->view->title = $category->get_sub_cat_select($id); } } And it comes from the following query: public function find_id_by_name($name){ $select = $this->getDbTable()->query("SELECT * FROM car_category WHERE category_name = '{$name}'"); $result = $select->fetchAll(); if(!$result) { return; } return $result[0]["ID"]; } It is the controller class i am looking to change rather than the query itself. I am testing it out by the title but it just doesnt seem to display at all. I would like it to display the drop down menus for the specific category, e.g car-live.local/cars/Volvo ---> "Welcome to the Volvo Car Finder" car-live.local/cars/BMW ---> "Welcome to the BMW Car Finder" I know it is not working as i have to split down the URL even more, as right now it is finding the id via the URL, but i am unsure how to do this :s Any light you can shed on this would be extremely grateful.. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.