Forum Moderators: coopster
<?
if($_SERVER['HTTP_REFERER'])
$THIS_PAGE_URL = $_SERVER['HTTP_REFERER'];
else
$THIS_PAGE_URL = './register.php?sid=' . $ATTSES;include_once('include/cookie.php');
include_once('include/form_utils.php');
check_vars('Required Fields are missing', 'name', 'email', 'location', 'password');
$MaxRank = one_result_query('SELECT MAX(member_rank) max FROM members');
old_one_query("INSERT into members VALUES ('', '$name', '$email', 1, '$location', '$password', $MaxRank[max], 0)");
Redirect('You are registred, good luck and thanks for joining Par5 Golf', './?sid=' . $ATTSES, 2);
?>
try this, I didn't test it but I think it works.
$MaxRank = mysql_query('SELECT MAX(member_rank) as max FROM members');
$maxvalue = mysql_fetch_array($MaxRank);
$newvalue = $maxvalue["max"] + 1;
there may be a better way to do it but it's late and I can't think of it now. I also assume that the member_rank is an int column.
A SELECT expression may be given an alias using AS. The alias is used as the expression's column name and can be used with ORDER BY or HAVING clauses. For example:mysql> SELECT CONCAT(last_name,', ',first_name) AS full_name
FROM mytable ORDER BY full_name;# It is not allowed to use a column alias in a WHERE clause, because the column value may not yet be determined when the WHERE clause is executed.