i'm totally beginner at php . i try to take the highest index of player in my database add to it 1 and then insert the new player information which the new index . here is my code :
$username = $_REQUEST['username'];
$password = $_REQUEST['password'];
$email = $_REQUEST['email'];
$con = mysqli_connect(...);
$asking = "SELECT MAX( playerNumber ) as playNum FROM Users";
$result = mysqli_query($con , $asking);
$row = mysql_fetch_array($result);
$numberOfPlayer = $row['playNum'] + 1;
$sql =
"INSERT INTO Users VALUES ( " . $numberOfPlayer . ", " . $username . "," . $password ."," . $email . " , 0)";
$result2 = mysqli_query($conn, $sql);
echo $result2;
mysqli_close($con);
if i ask the query in phpmyadmin its give me the answear but if i try to do something it print me this eror :
Warning: mysql_fetch_array() expects parameter 1 to be resource, object given in /home/u521040346/public_html/learning.php on line 8
thanks for helping.