Sqlite
#1

I have 2 tables
PHP код:
    /* CUENTA */
    
format(DB_Querysizeof(DB_Query), 
    
"\
        CREATE TABLE IF NOT EXISTS `CUENTA`\
        (\
            `ID` INTEGER PRIMARY KEY AUTOINCREMENT,\
            `IP` VARCHAR(16),\
            `NAME` VARCHAR(24),\
            `EMAIL` VARCHAR(32),\
            `PASS` INTEGER,\
            `LAST_CONNECTION` VARCHAR(24) DEFAULT CURRENT_TIMESTAMP,\
            `LAST_CONNECTION_TIMESTAMP` INTEGER DEFAULT '0',\
            `TIME-PLAYING` INTEGER DEFAULT '0',\
            `LEVEL` INTEGER DEFAULT '1',\
            `REP` INTEGER DEFAULT '1',\
            `STATE` INTEGER DEFAULT '0'\
        );\                                        
    "
);
    
db_query(DatabaseDB_Query);
    
    
/* REGISTRO */
    
format(DB_Querysizeof(DB_Query), 
    
"\
        CREATE TABLE IF NOT EXISTS `REGISTRO`\
        (\
            `ID_USER` INTEGER,\
            `IP` VARCHAR(16),\
            `NAME` VARCHAR(24),\
            `EMAIL` VARCHAR(32),\
            `PASS` INTEGER,\
            `DATE` VARCHAR(24) DEFAULT CURRENT_TIMESTAMP,\
            FOREIGN KEY (ID_USER) REFERENCES CUENTA(ID) ON DELETE CASCADE\
        );\        
    "
);
    
db_query(DatabaseDB_Query); 
I use FOREIGN KEY (ID_USER) REFERENCES CUENTA(ID) ON DELETE CASCADE

When execute 'DELETE FROM `CUENTA` WHERE `ID` = 'x';' only delete record from CUENTA table but record is not deleted on REGISTRO table.

Is this possible in sqlite?
Reply
#2

Solved
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)