Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PHP Ive been having troubles with this project for a few days now. I am haing troubles with displaying the vehicles with the selected filter

PHP

Ive been having troubles with this project for a few days now. I am haing troubles with displaying the vehicles with the selected filter and displaying the images associated with them. Here is a complete list of what i have to do: I Need To - Find any errors in the code - Properly include and initialize the class. - Populate the Filters using the class provided as outlined in the index.php file. - Properly post the Filters form. - Populate the Vehicle Results using the class and the Filters as outlined in the index.php file. - Layout and style your vehicle results. - Leverage lightGallery to display larger images.

This Is What I Have So Far index.php 
 
 

Sample Project

Filters

-Year- get_vehicle_years(); sort($getYear); // Iterate through the product array foreach($getYear as $years){ echo "$years"; } // Collect value from form using POST $year = $_POST['year']; ?> -Make- get_vehicle_makes(); sort($getMake); // Iterate through the product array foreach($getMake as $makes){ echo "$makes"; } // Collect value from form using POST $make = $_POST['make']; ?> -Model- get_vehicle_models(); sort($getModel); // Iterate through the product array foreach($getModel as $models){ echo "$models"; } // Collect value from form using POST $model = $_POST['model']; ?>

Vehicles

data_array = $data_array; } public function get_vehicles(&$year='', &$make='', &$model=''){ $response = array(); foreach($this->data_array as $data){ $success = true; if($year != '' && $data[1] != $year){ $success = false; echo "ERROR"; } if($make != '' && $data[2] != $make){ $success = false; echo "ERROR"; } if($model != '' && $data[3] != $model){ $success = false; echo "ERROR";} if($success){ $response[] = array( 'id' => $data[0], 'year' => $data[1], 'make' => $data[2], 'model' => $data[3]); } return $response; } } public function get_vehicle_id(){ $response = array(); foreach($this->data_array as $data){ $response[] = $data[0]; } return array_unique($response); } public function get_vehicle_years(){ $response = array(); foreach($this->data_array as $data){ $response[] = $data[1]; } return array_unique($response); } public function get_vehicle_makes(){ $response = array(); foreach($this->data_array as $data){ $response[] = $data[2]; } return array_unique($response); } public function get_vehicle_models(){ $response = array(); foreach($this->data_array as $data){ $response[] = $data[3]; } return array_unique($response); } public function get_vehicle_images($id){ $response = array(); for($i=4; $idata_array[$id]); $i++){ if($this->data_array[$id][$i] != '' && file_exists('img/'.$this->data_array[$id][$i])){ $response[] = $this->data_array[$id][$i]; } } return $response; } } ?>

warehouse.csv

 

Expand Copy Code

1991,Alfa Romeo,164L,853d9a63-12ce-45c7-9e8f-ac1a1da15ced.jpg,, 2005,Ferrari,F1 Spider,8a39d397-d9b9-4692-b531-3e8571354614.jpg,4949659d-4f9e-4a3e-97d4-b57794ad32fb.jpg, 2007,Maserati,Quattroporte,82eb91b5-53f1-48cc-91b4-fe19ad22576d.jpg,b4a1847f-a6e8-4fa5-a3b4-e44f064fc88c.jpg, 2008,Audi,A5,9f972e54-74e4-4fdb-9366-012e91e03b5e.jpg,52c389f4-e9b4-4ec3-bb68-d48b3c06d08a.jpg,493ad6ba-7f72-44a1-b0c4-6d79744153f3.jpg 2009,Audi,TT,2d84fbdc-fb8f-462c-81ea-40bd9ecc168d.jpg,9a3c8f29-e574-4544-8eb8-86eb944e5f69.jpg,81b007ff-89c7-4fe1-b945-3f8b4ad15a7a.jpg 2009,Hummer,H3T,355f5ccc-333d-4ab3-8341-8e6441a6f179.jpg,fd344164-2e0a-47e9-8171-00f0e055f0d1.jpg, 2010,Dodge,Dakota,14eaf83d-56f6-4d96-aa80-1ec701cb7fff.jpg,d962f3f0-36ae-40dd-8567-890e9849f083.jpg, 2012,Dodge,Journey,50b13842-7fc3-4438-946b-3b9cc31e10bc.jpg,150b79ed-5cf3-4279-9e7e-271c6ea8a3d3.jpg,775d9c87-c31f-4f62-b26d-28c3fa597b39.jpg 2012,Mini,Cooper,09e1d1d4-8259-42a6-a8f9-baa2a69be9bf.jpg,866f5f85-446a-4c19-b1cc-256841c5c293.jpg,e91ad065-842a-484f-a90f-4256f7c8830a.jpg 2013,Mini,Cooper,5c1e6371-d8f8-4769-8d93-8d41c8051411.jpg,631219d1-6304-4b26-b5ba-ca465f6b1934.jpg,eb1a80a1-f448-4c6b-bd95-a942a206441d.jpg 1967,Pontiac,Firebird,2bbae7b2-c1ea-409e-b9c4-54a37e9ce062.jpg,5374d77f-5233-441b-b717-022e57e4fcb6.jpg,7543abae-2077-4676-a69f-1f6490aee034.jpg 1980,AMC,Spirit,039ed535-48e2-448b-8bb1-5c3739fb16ea.jpg,f3cb6293-5b95-46b3-95bd-c5144a19cace.jpg, 1991,Eagle,Talon,d3158a02-ef75-4664-a967-2b068f85be97.jpg,, 2003,Lamborghini,Murcielago,9e27531e-3040-4ad1-aabb-d8681594cbf2.jpg,45c82875-62cc-4b9e-be01-984cb087e8ca.jpg,94ebae9c-0b76-4d61-ae7d-f33ad5155c23.jpg 2007,BMW,X3,81e80677-1030-4671-8382-ea1a2f55ec48.jpg,b87988b9-1a15-4823-b883-d59c65f6aeef.jpg,bd77b49c-89c3-4a67-87c4-e1620ed7c6dd.jpg 2007,Sterling,360,20070201120516328_c75fc9f47ce64a9281b78a5a50a4bc9b0-orig.jpg,, 2009,Aston Martin,Vantage,0a60bd3c-04a3-48cb-af09-6fecc27c152f.jpg,52e0b69b-b000-4a4a-8f47-87900aeed9e4.jpg,038657f9-bdf2-4f03-93ec-a1a97ae37b8b.jpg 2012,Bentley,Continental,0c11fd9e-4243-478b-a418-275736b43734.jpg,3d25f96f-1761-4d99-b72c-924716c1486f.jpg,49e510d3-f546-4643-b71c-1e597a546254.jpg 2013,Jaquar,XJ,16a8fd60-1867-4c8f-b452-55b70294b909.jpg,564768a9-824f-4fb4-acd4-763147b3ed58.jpg, 2014,Lotus,Seven Westfield,2ab60193-6a9c-4663-96a7-46df85efdcc6.jpg,2c32e562-adae-4eda-8a68-09df89aec912.jpg,c303483b-eb62-49ca-8daf-5c7dddd0e005.jpg

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

Advance warning and an explanation for the layoff.

Answered: 1 week ago

Question

Assessment of skills and interests.

Answered: 1 week ago