Delete not really deleting character

Results 1 to 5 of 5
  1. #1
    Valued Member itsmemario is offline
    MemberRank
    Aug 2016 Join Date
    103Posts

    Delete not really deleting character

    I noticed when you delete a character ingame it remains in the database but without the character name (empty)

    I tried adding this to dbo.spDeleteChar

    DELETE from Character
    WHERE CID=@CID


    But it didnt work... any way to completely delete the row of the deleted character?

    Thanks a lot.

    (This is because the empty character name remains in my website script)

    Here is the whole DB script for deleting character

    set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    GO
    /* ij¸¯ÅÍ »èÁ¦ */
    ALTER PROC [dbo].[spDeleteChar]
    @AID int,
    @CharNum smallint,
    @CharName varchar(24)
    AS
    SET NOCOUNT ON
    DECLARE @Cid int
    DECLARE @CashItemCount int

    SELECT @Cid=CID FROM Character WITH (nolock) WHERE AID=@AID and CharNum=@CharNum
    IF @Cid IS NULL)
    BEGIN
    return (-1)
    END

    SELECT @CashItemCount=COUNT(*) FROM CharacterItem(nolock) WHERE CID @Cid AND ItemID>=500000

    IF (@CashItemCount > 99) OR
    (EXISTS (SELECT TOP 1 CLID FROM ClanMember WHERE CID @Cid))
    BEGIN
    return (-1)
    END

    UPDATE Character SET CharNum = -1, DeleteFlag = 1, Name='', DeleteName=@CharName
    WHERE AID=@AID AND CharNum=@CharNum AND Name=@CharName
    DELETE from Character
    WHERE CID=@CID


    SELECT 1 AS Ret

    Last edited by itsmemario; 22-08-16 at 07:35 PM.


  2. #2
    Valued Member Keristrasza is offline
    MemberRank
    Jun 2015 Join Date
    128Posts

    Re: Delete not really deleting character

    It's a soft delete, it's supposed to work that way. Your website should just not be displaying characters with the DeleteFlag set.

    If you really want to delete them, the stuff you posted seems like it'd work o-o Not sure why it wouldn't

  3. #3
    Valued Member itsmemario is offline
    MemberRank
    Aug 2016 Join Date
    103Posts

    Re: Delete not really deleting character

    Quote Originally Posted by Keristrasza View Post
    It's a soft delete, it's supposed to work that way. Your website should just not be displaying characters with the DeleteFlag set.

    If you really want to delete them, the stuff you posted seems like it'd work o-o Not sure why it wouldn't
    I'm not quite sure how to implement DeleteFlag checking into this code.

    <?php
    $sqlacc = mssql_query("SELECT * FROM Account WHERE UserID='".$_SESSION['user']."'");
    $sqlaccres = mssql_fetch_assoc($sqlacc);
    echo $sqlaccres['AID'];
    $sqlchar = mssql_query("SELECT * FROM Character WHERE AID='".$sqlaccres['AID']."' ORDER BY CID DESC");
    while($sqlchr = mssql_fetch_assoc($sqlchar)){
    ?>
    -edit-

    yeah the sql code isnt deleting it at all... thanks a lot if someone could implement DeleteFlag in the php code as I cant do it myself.
    Last edited by itsmemario; 22-08-16 at 09:25 PM.

  4. #4
    Valued Member Keristrasza is offline
    MemberRank
    Jun 2015 Join Date
    128Posts

    Re: Delete not really deleting character

    something like "SELECT * FROM Character WHERE AID='".$sqlaccres['AID']."' AND DeleteFlag <> 1 ORDER BY CID DESC" should work

  5. #5
    Valued Member itsmemario is offline
    MemberRank
    Aug 2016 Join Date
    103Posts

    Re: Delete not really deleting character

    Quote Originally Posted by Keristrasza View Post
    something like "SELECT * FROM Character WHERE AID='".$sqlaccres['AID']."' AND DeleteFlag <> 1 ORDER BY CID DESC" should work
    That works perfectly thank you one more time!!



Advertisement