Note that there are some explanatory texts on larger screens.

plurals
  1. PO404 Page not found Codeigniter
    primarykey
    data
    text
    <p>I'm new to codeigniter. I'm making crud from a tutorial, whenever I clicked the Edit.</p> <p>It links to.. <code>http://localhost/crud/index.php/users/edit/1</code></p> <p>and I'm getting I'm getting <strong>404 Page not Found.</strong></p> <p>I think it's just a problem on the uri or pagination of the controllers. What would be the problem?</p> <p><strong>users.php - controller</strong></p> <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Users extends CI_Controller { function __construct() { parent::__construct(); #$this-&gt;load-&gt;helper('url'); $this-&gt;load-&gt;model('users_model'); } public function index() { $data['user_list'] = $this-&gt;users_model-&gt;get_all_users(); $this-&gt;load-&gt;view('show_users', $data); } public function add_form() { $this-&gt;load-&gt;view('insert'); } public function insert_new_user() { $udata['name'] = $this-&gt;input-&gt;post('name'); $udata['email'] = $this-&gt;input-&gt;post('email'); $udata['address'] = $this-&gt;input-&gt;post('address'); $udata['mobile'] = $this-&gt;input-&gt;post('mobile'); $res = $this-&gt;users_model-&gt;insert_users_to_db($udata); if($res){ header('location:'.base_url()."index.php/users/".$this-&gt;index()); } } public function delete_a_user($id) { $this-&gt;db-&gt;where('users.id',$id); return $this-&gt;db-&gt;delete('users'); } public function delete($id) { $this-&gt;users_model-&gt;delete_a_user($id); $this-&gt;index(); } public function update() { $mdata['name']=$_POST['name']; $mdata['email']=$_POST['email']; $mdata['address']=$_POST['address']; $mdata['mobile']=$_POST['mobile']; $res=$this-&gt;users_model-&gt;update_info($mdata, $_POST['id']); if($res){ header('location:'.base_url()."index.php/users/".$this-&gt;index()); } } } </code></pre> <p><strong>show_users.php - views/html</strong></p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;CI CRUD&lt;/title&gt; &lt;script type="text/javascript"&gt; function show_confirm(act,gotoid) { if(act=="edit") var r=confirm("Do you really want to edit?"); else var r=confirm("Do you really want to delete?"); if (r==true) { window.location="&lt;?php echo base_url();?&gt;index.php/users/"+act+"/"+gotoid; } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h2&gt; Simple CI CRUD Application &lt;/h2&gt; &lt;table width="600" border="1" cellpadding="5"&gt; &lt;tr&gt; &lt;th scope="col"&gt;Id&lt;/th&gt; &lt;th scope="col"&gt;User Name&lt;/th&gt; &lt;th scope="col"&gt;Email&lt;/th&gt; &lt;th scope="col"&gt;Mobile&lt;/th&gt; &lt;th scope="col"&gt;Address&lt;/th&gt; &lt;th scope="col" colspan="2"&gt;Action&lt;/th&gt; &lt;/tr&gt; &lt;?php foreach ($user_list as $u_key){ ?&gt; &lt;tr&gt; &lt;td&gt;&lt;?php echo $u_key-&gt;id; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $u_key-&gt;name; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $u_key-&gt;email; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $u_key-&gt;address; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $u_key-&gt;mobile; ?&gt;&lt;/td&gt; &lt;td width="40" align="left" &gt;&lt;a href="#" onClick="show_confirm('edit',&lt;?php echo $u_key-&gt;id;?&gt;)"&gt;Edit&lt;/a&gt;&lt;/td&gt; &lt;td width="40" align="left" &gt;&lt;a href="#" onClick="show_confirm('delete',&lt;?php echo $u_key-&gt;id;?&gt;)"&gt;Delete &lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php }?&gt; &lt;tr&gt; &lt;td colspan="7" align="right"&gt; &lt;a href="&lt;?php echo base_url();?&gt;index.php/users/add_form"&gt;Insert New User&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload