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?

Link to comment
Share on other sites

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); 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.