Updating Database

Hello,

I am trying to make a mysql query that will update a users rank in the database. Below, I have posted the whole code, SQL included. Can you guys see why its not working?

case'editusr':
		include('config.php');
$ranks = array('Banned' => 0, 'Admin' => 1, 'User' => 2);
		if($_SESSION['s_rank'] == "2") {

echo'You do not have the permissions to view this page.';

}

if($_SESSION['s_rank'] == "1"){
$result = mysql_query("UPDATE * FROM Users WHERE Username is defined by 'Username' And if 0 = 'Banned' or 1 = 'Admin' or 2 = 'User'");

echo'On this page you can edit the rank of a user.
<p>
		<form action="'.$_SERVER['PHP_SELF'].'" method="post">
		<p>Username to Edit:<br>
		<input name="Username" type="text" class="textBox"></p>
		<p>Change To:<br>
		<select name="user_level">
			<option value="' .$ranks['Banned']. '">Banned</option>
			<option value="' .$ranks['Admin']. '">Admin</option>
			<option value="' .$ranks['User']. '">User</option>
		</select></p>
		<p><input type="submit" value="Change Rank" name="changerank"></p>
		</form>
		';
		

}

		break;

use mysql_error() with your update to find out why it isn’t working.

hint the FROM clause is incorrect

do yourself a huge favour, test your query outside of php first

You’re inventing your own version of mysql with its own personal syntax

Have a look at this example http://www.tizag.com/mysqlTutorial/mysqlupdate.php

and the “is defined by” in the WHERE clause is looking pretty wonky, too

:cool:

I get this error, and I am not sure what it meas… Google cant help me here

Warning: Wrong parameter count for mysql() in /home/justin/public_html/images/acp/member.php  on line 214
Array ( [Username] => [Rank] => ) 1On