- This topic is empty.
June 6, 2016 at 9:22 am #242560cscodismithParticipant
I currently am in the process of setting up an ‘admin panel’ where those users who have admin_level 2 have a module that are displayed to them on the homepage that look something like this. I want it so upon the level 2 Administrator clicking on 1 / 2 it will change the admin level of the user in that table with it. I am not sure how exactly to do this with an onclick function and not sure what more to put in my query?
$connStr = 'mysql:host=localhost;dbname=heartfx_website'; $user = 'root'; $pass = ''; $conn = new PDO($connStr, $user, $pass); // update $update = $conn->prepare("UPDATE admin_level FROM users SET ? WHERE ")
Any help would be greatly appreciated!
CodiJune 6, 2016 at 1:34 pm #242571rkieruParticipant
So there are two ways to achieve this.
Apply and Redirect
In a scenario like this the button would either be a link or a form that takes the user off the current page, applies the update, and then returns the user to the original page.
So for example:
The user would then be directed to that page (assume it has the code you presented above) and then redirected upon completion back to the list of users via
In a scenario like this, the button would function much the same, except you would be submitting the call via AJAX and notifying the user of the results. In this situation the user would never leave the current page.
- The forum ‘Back End’ is closed to new topics and replies.