Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5934277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:05:30+00:00 2026-05-22T15:05:30+00:00

i need help on my code below. Im using codeigniter as my framework for

  • 0

i need help on my code below. Im using codeigniter as my framework for this development

View

<table>
                        <tr>
                            <th>ID</th>
                            <th>Username</th>
                            <th>Email Address</th>
                            <th>Actions</th>
                        </tr>
                        <?php foreach($query as $row){?>
                        <tr>
                            <td><?php print $row->id; ?></td>
                            <td><?php print $row->username; ?></td>
                            <td><?php print $row->email; ?></td>
                            <td><?=anchor('userslist/get_Admin/'.$row->id, 'Edit');?>&nbsp;|&nbsp;<?=anchor('userslist/deleteAdmin/'.$row->id, 'Delete');?></td>
                        </tr>
                        <?php }?>
                    </table>

Controller

        function get_Admin($id)
    {
        $data['query']=$this->usermodel->get_Admin($id);
        $this->load->view('admin/users/edit-user-template',$data);
    }

View (update forms)

<table>
    <tr>
        <th colspan="2">Update an Admin Account</th>
    </tr>
     <?php echo form_open('userslist/update_admin'); ?>
    <tr>
        <td>Username</td>
        <td>
        <?php
            $data = array('name'=>'username', 'id'=>'username', 'class'=>'signup-txtbox', 'value'=>$query['username']);
            echo form_input($data);
        ?>
        </td>
    </tr>
    <tr>
        <td>Email</td>
        <td>
        <?php
            $data = array('name'=>'email', 'id'=>'email', 'class'=>'signup-txtbox', 'value'=>$query['email']);
            echo form_input($data);
        ?>
        </td>
    </tr>
    <tr>
        <td>Password</td>
        <td>
        <?php
            $data = array('name'=>'password', 'id'=>'password', 'class'=>'signup-txtbox', 'value'=>'');
            echo form_input($data);
        ?>
        </td>
    </tr>
    <tr>
        <td>Confirm Password</td>
        <td>
        <?php
            $data = array('name'=>'password2', 'id'=>'password2', 'class'=>'signup-txtbox', 'value'=>'');
            echo form_input($data);
        ?>
        </td>
    </tr>
    <tr>
    <tr>
        <td>&nbsp;</td>
        <td>
        <?php
            $data = array('name'=>'submit', 'id'=>'submit', 'class'=>'signup-btn', 'value'=>'Update Acccount');
            echo form_submit($data);
        ?>
        </td>
    </tr>
    <tr>
        <td colspan="2"><?php echo validation_errors('<p class="error">'); ?></td>
    </tr>
</table>

controller

        function update_admin()
        {
            $this->usermodel->update_admin();
            redirect('userslist');

}

Model

        function update_admin()
    {
        $update_admin_data = array(
                'username' => $this->input->post('username'),
                'email' => $this->input->post('email'),
                'password ' => md5($this->input->post('password '))
            );
            $this->db->where('id',$id);
            $update = $this->db->update('users', $update_admin_data);
            return $update;
    }

the whole code doesn’t update the selected record it just happens that it just redirects to the page without the update. what could be the possible solution for this?

thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:05:31+00:00Added an answer on May 22, 2026 at 3:05 pm

    You are missing the $id attribute. Update the form submit in your second view:

    <?php echo form_open('userslist/update_admin/'.$query['id']); ?>
    

    Fix your second controller:

    function update_admin($id)
            {
                $this->usermodel->update_admin($id);
                redirect('userslist');
    }
    

    Finally, fix your update_admin model function to start like this:

     function update_admin($id)
        {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help on this following aspx code aspx Code: <asp:Label ID =lblName runat
i need help with disk_total_space function.. i have this on my code <?php $sql=select
Kind of stuck with this thing, that's why need help please. I am using
Using the below table structure i need to insert the Line ID into the
I need help on how to change my code below to use my own
i need to draw something like the image below using WPF... i need this
I've gone through most of the example code and I still need some help.
I need help with this route map routes.MapRoute(Blog_Archive, Blog/Archive/{year}/{month}/{day}, new { controller = Blog,
I need help making this loop to move a label move smoothly across the
ASP.NET 4.0 Need some help with this vexing HTTP POST problem - I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.