Jump to content

php/mysql- changing a mysql table name threw php?


mybluehair

Recommended Posts

ok, i have a membership system. one of the feilds in the 'users' table in mysql is called rank. it has 2 posibilities. 1 or 2. 1 means ur a regular member. 2 means your an admin. so in the admin panel, i want to make a part were you can change the rank on a certain user. i was thinking about maybe a html form kinda, where you enter there username, then php searches for it in mysql. when it finds the desired row, it will display there ranking in a dropdown menu. you can change the ranking in this drop-down, and then click submit. then php would change the ranking in mysql. can someone show me the basic sql commands and php to do this?

The concept would be like this...Just fill in the blanks

 

$username = $_POST['username'];
$newRank = $_POST['rank'];

$result=mysql_query("SELECT uid FROM tblUsers WHERE username = '$username');
$record = mysql_fetch_row($result);

$update="UPDATE tblUsers SET rank='$newRank' WHERE username='$username' ";
$update_result=mysql_query($update); 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.