prepare("UPDATE userinfo SET prefcharid = 0, prefcharname = 'No default selected' WHERE userid = ?"); $ncp->bind_param("i", $_SESSION['userid']); $ncp->execute(); $ncp->close(); $_SESSION['prefcharid'] = "0"; $_SESSION['prefcharname'] = "No default selected"; $_SESSION['charprofid'] = "0"; } else { // $scp = Selected CharID Preferrence $scp = $con->prepare("SELECT charid, charname, profid FROM gwchars WHERE charid = ? AND accid = ? AND userid = ?"); $scp->bind_param("iii", $_POST['prefcharid'], $_SESSION['prefaccid'], $_SESSION['userid']); $scp->execute(); $result = $scp->get_result(); while ($row = $result->fetch_assoc()) { $uap = $con->prepare("UPDATE userinfo SET prefcharid = ?, prefcharname = ? WHERE userid = ?"); $uap->bind_param("isi", $_POST['prefcharid'], $row['charname'], $_SESSION['userid']); $uap->execute(); $uap->close(); $_SESSION['prefcharid'] = $row['charid']; $_SESSION['prefcharname'] = $row['charname']; $_SESSION['charprofid'] = $row['profid']; } } } ?>