Posts: 8
Threads: 7
Joined: Jan 2015
Reputation:
0
i have a tables combination of two names , these two names are in different table like friend 1 and friend 2 . when i delete one name from the friend 1 or friend 2, i should delete the combination table . now i know only the half of the name of the table example : the table name is thamaraiselvam_kuppuraj when i delete kuppuraj from the friends 2 table. i should delete thamaraiselvam_kuppuraj table also. how to write query for this?
$this->dbforge->drop_table('table name');
can i use above query with some modification?
Thanks and Regards,
Thamaraiselvam T
Posts: 421
Threads: 24
Joined: Oct 2014
Reputation:
18
Its not possible..
Think this way:
if you have : "thamaraiselvam_kuppuraj" , "thamaraiselvam_kuppuraj2", "thamaraiselvam2_kuppuraj" any try to match them can drop more tables than you need to be dropped ..
Better make a new table where to list all tables combinations and when you delete 1 name it will use this new table to catch tables to be dropped..
Posts: 671
Threads: 17
Joined: Oct 2014
Reputation:
37
Argh... You should have known 90% of the table name. :-)
Posts: 428
Threads: 0
Joined: Jan 2015
Reputation:
25
It sounds like you don't have a truly relational database set up. There shouldn't be "friend1" and "friend2" tables. There should be one table, friends, probably with an ID, user_id and a friend_id, which can store as many friends per user as you need.