Hello, I would like to have a link in my admin back-end to "reset a value to 0 in a mysql database". For example: In "xyz_users" a value has "29" and so I would like to reset that specific value with a link in the admin section. How can I go about doing so? Thank you!
Do you mean the AUTO_INCREMENT value? Is xyz_users a table or a row? If not, what would you like to achieve?
If it's the auto increment it's not possible wiithout truncating the whole table. If the 29 is just a normal field, but still unique, you can do a simlpe query of UPDATE `xyz_table` WHERE `column_name` = '29'
if ($row["column"] >= 29) { echo $link } PHP: You can use a GET to initiate the update or you can write an ajax function to do it.
just have an update user button <?php //Reseting User Value if (isset($_POST['reset_user'])) { $user_name = 'xyz_users'; //Resetting $update_user = "UPDATE user_table SET specific_value='0' WHERE username='$user_name'"; mysql_query($update_user) or die ('Can\'t Update'); } ?> <form action="" method="post"> <input name="reset_user" type="submit" value="Reset Value" /> </form> PHP: