I've pretty much never coded in PHP and MySQL before, so you'll have to excuse my god awful code.
I have a 3 columns in my database. ID, Class, and Need.
Basically, I'm trying to find the easiest way for me to code a page in order to allow users to change the "Need" value of each row from 0 to 1, or 1 to 0.
Currently I have it working where I have 2 buttons that run 2 separate but almost identical scripts whose only purpose is to change a specific row's "Need" value to 1 or 0 (shown below)
<?php
mysql_connect("localhost", "muffins", "sugarcookies") or die(mysql_error());
mysql_select_db("crackers_cheese") or die(mysql_error());
mysql_query("UPDATE recruitment SET Need=1
WHERE ID='1'");
mysql_close($con);
header("location: /admin.html");
?>
The inverse .php file is identical except for "SET Need=0"
So, what can I do instead of having 22 individual .php files whos only purpose is setting each specific row to 0 or 1.
Thanks!