Everything works here for me except grabbing the main accounts ID and inserting it into my server1 account_id table
Basically i'm taking the session accounts ID and using the account ID to identify the players mage with the owners account. Everything works correctly except for the account_id gets resource #5 error.. I'm sure my problem lies with a very simple step to fix it, but as I am new to deep php details, I cannot figure this out.
Thanks to all who can help me out
// Check if mage name is taken
$check_user_data = mysql_query("SELECT playername FROM players_server1 WHERE playername = '$magename'") or die(mysql_error());
// If not taken it creates the mage and inserts into the database
if(mysql_num_rows($check_user_data) == 0){
$username= $SESSION['username'];
$account_id=mysql_query("SELECT id FROM accounts WHERE username = '$username'") or die(mysql_error());
$accountIDresult=$account_id;
$magic_color= trim($POST['usercolor']);
$class=trim($_POST['userclass']);
$create_mage = mysql_query("INSERT INTO players_server1 (playername,account_id, magic_color, class)
VALUES('$magename','$accountIDresult','$magic_color','$class')");
$final_report.="Creating Your mage. . .. <meta http-equiv='Refresh' content='2; URL=index.php'/>";
}