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 7503615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:17:19+00:00 2026-05-29T21:17:19+00:00

A User clicks on ‘View Users’ and the php logic fetches the data using

  • 0

A User clicks on ‘View Users’ and the php logic fetches the data using MySQL SELECT, passes the data to the table_view, then displays all the ‘Users’ on the system.

Each table row has a ‘edit’ hyperlink which fetches an array or form elements, this array of form elements is passed to a ‘Form_Generator’ which generates the html for the form array, the values for the form are also added in.

So the User is faced with a form ( sometimes 20 elements large ) with the form element values matching the values in the database.

MY QUESTION IS…

How can I make the update dynamic? If not dynamic, how can I make it better?

My current Method is so…


When the user has eddited the values they submit the form, then validation.

might i add that one form may consist of 3 or more tables in the relational database

I could write an update statement for EACH element like:

if ( isset ( $user_input["firstname"] ) )
{
    $this -> _database -> update( "UPDATE users SET firstname = '{$user_input["firstname"]}' WHERE user_id = $user_id" );
    $this -> _database -> execute();
}
etc etc for ALL fields

or I could use an UPDATE statement with JOINS to update multiple fields at once. like so:

$this-> _database -> custom("UPDATE fitters AS f INNER JOIN user_types AS ut ON f.fitter_id = ut.type_id INNER JOIN users AS u ON u.user_id = ut.user_id SET f.title = '{$user_input["title"]}', f.firstname = '{$user_input["firstname"]}', f.surname = '{$user_input["surname"]}', u.email_address = '{$user_input["email_address"]}' WHERE u.user_id = {$user_input["user_id"]}");

Does anybody know of a better way to do this?

How have you tackled updating database information in your projects?

  • 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-29T21:17:23+00:00Added an answer on May 29, 2026 at 9:17 pm

    Using a framework for applications makes life alot easier. I personally like to work with CodeIgniter.
    When using a framework like CodeIgniter database operations become a lot easier. Here is an example of how it could be:

    public static function editProfile($data)
    {
        $user = User::find_by_pk($data['id']);
    
        if (isset($data['username'])) {
    
            $user->username = $data['username'];
        }
    
        if (isset($data['password'])) {
    
            $user->hashed_password = User::hash_password($data['password']);
        }
    
        $user->save();
    }
    

    http://codeigniter.com/

    This is great website with tutorials to get you started on the subject!

    http://heybigname.com/2009/09/04/developing-a-website-with-code-igniter-part-1-configuration/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem - user clicks do something button (view), view model receives command and passes
when user clicks on login button (index.php) I am calling chechlogin.php where I am
When a user clicks on a cell in table , the view should switch
When the user clicks on a item in my single-select ListBox , the item
When user clicks row I want to display data in inputs so it is
Details: Only disable after user clicks the submit button, but before the posting back
When a user clicks on an image on a web page, I'd like to
When a user clicks a submit button I want the form to be submitted.
Use case: user clicks the link on a webpage - boom! load of files
When the user clicks on a row in the datagrid (or uses the keyboard),

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.