• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to delete a table when i know half name of the table in ci

#1
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
Reply

#2
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..
Best VPS Hosting : Digital Ocean
Reply

#3
(01-21-2015, 01:59 AM)sv3tli0 Wrote: 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..

Thank you Big Grin Big Grin
Thanks and Regards,
Thamaraiselvam T
Reply

#4
Argh... You should have known 90% of the table name. :-)
Reply

#5
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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.