Search code examples
phpmysqldatabasecodeignitercodeigniter-2

How to delete a table when i know half name of the table in ci


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?

thank in advance


Solution

  • You first need to find the name of the table:

    show tables like '%_kuppuraj'
    

    Now you have name of the table.