Welcome Guest, Not a member yet? Register   Sign In
can't get link to work
#1

Hi,

I've been following a youtube video on creating a website with the use of codeigniter. The video is PHP and MySQL Get and Display Products - 6 -41.

I've followed the video so far but have got stuck.

So far the video has shown me how to load xampp on to my windows 10 machine; copy the codeigniter folder over to hdocs; create a database with mysql; create a page that pulls in header, product content, and footer; pull the product information from the database to display it on the main page. The main page is localhost/thegamingplace

I have got stuck trying to get a link to display another page. This link on the main page is:

<a href="<?php echo base_url(); ?>products/details/<?php echo $product->id; ?>">

So it goes to the main page which i have set in the config.php file to $config['base_url'] = 'http://localhost/thegamingplace/';

Then it supposed to go to the products controller and then call the details function and display the details.
In routes.php it is set to: $route['default_controller'] = 'products';

I have a file called products.php in the controllers folder that looks like this:
<?php
class Products extends CI_Controller{
 public function index(){
  //Get All Products
  $data['products'] = $this->Product_model->get_products();
  //Load View
     $data['main_content'] = 'products';
  $this->load->view('layouts/main', $data);
 }

 public function details($id){
  //Get Product Details
  $data['product'] = $this->Product_model->get_product_details($id);
  //Load View
  $data['main_content'] = 'details';
  $this->load->view('layouts/main', $data);
 }
}

When I click on the link i get: http://localhost/thegamingplace/products/details/1
But with an error message:Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

localhost
Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.6.19
 
I've followed the video exactly and rewatched it about 5 times now. In the video it works for him. If anyone could help it would be very much appreciated.
Reply


Messages In This Thread
can't get link to work - by richie41 - 03-24-2016, 08:54 AM
RE: can't get link to work - by Paradinight - 03-24-2016, 12:26 PM
RE: can't get link to work - by richie41 - 03-24-2016, 02:59 PM
RE: can't get link to work - by twpmarketing - 03-24-2016, 02:30 PM
RE: can't get link to work - by richie41 - 03-24-2016, 02:48 PM
RE: can't get link to work - by pdthinh - 03-24-2016, 07:01 PM
RE: can't get link to work - by richie41 - 03-25-2016, 02:43 AM
RE: can't get link to work - by richie41 - 03-24-2016, 02:51 PM
RE: can't get link to work - by Wouter60 - 03-25-2016, 02:54 AM
RE: can't get link to work - by richie41 - 03-25-2016, 03:05 AM
RE: can't get link to work - by Avenirer - 03-25-2016, 03:21 AM
RE: can't get link to work - by richie41 - 03-25-2016, 03:22 AM
RE: can't get link to work - by Wouter60 - 03-25-2016, 03:23 AM
RE: can't get link to work - by richie41 - 03-25-2016, 03:41 AM
RE: can't get link to work - by pdthinh - 03-25-2016, 05:46 AM
RE: can't get link to work - by richie41 - 03-25-2016, 11:24 AM
RE: can't get link to work - by InsiteFX - 03-25-2016, 03:54 AM
RE: can't get link to work - by richie41 - 03-25-2016, 04:03 AM
RE: can't get link to work - by InsiteFX - 03-25-2016, 12:59 PM
RE: can't get link to work - by richie41 - 03-25-2016, 01:41 PM
RE: can't get link to work - by Wouter60 - 03-26-2016, 01:20 AM
RE: can't get link to work - by richie41 - 03-26-2016, 03:17 AM
RE: can't get link to work - by Wouter60 - 03-26-2016, 03:43 AM
RE: can't get link to work - by richie41 - 03-26-2016, 03:55 AM
RE: can't get link to work - by InsiteFX - 03-26-2016, 03:33 AM
RE: can't get link to work - by richie41 - 03-26-2016, 03:37 AM
RE: can't get link to work - by Wouter60 - 03-26-2016, 04:51 AM
RE: can't get link to work - by richie41 - 03-26-2016, 04:55 AM
RE: can't get link to work - by Wouter60 - 03-26-2016, 06:02 AM
RE: can't get link to work - by richie41 - 03-26-2016, 06:21 AM
RE: can't get link to work - by Wouter60 - 03-26-2016, 08:01 AM
RE: can't get link to work - by richie41 - 03-26-2016, 08:09 AM
RE: can't get link to work - by veronvynguyen - 03-12-2017, 01:57 PM
RE: can't get link to work - by kieranfitz - 04-21-2018, 04:40 PM
RE: can't get link to work - by InsiteFX - 04-22-2018, 04:27 AM
RE: can't get link to work - by InsiteFX - 04-22-2018, 04:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB