Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved How to check table exists (Sqlite3)

Comments in 'Plugin Development' started by korado531m7, Aug 7, 2016.

  1. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    I'm trying to make a plugin that use database. but i cannot write a function check table exists (if exists, it will return true).
    I googled about it, but i couldn't write that.

    how to write this?
    please tell me. thank you for reading my threads and answering.
  2. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    Primus likes this.
  3. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    Thank you for answering.
    I already checked that page and tested.
    But there is not numRows() function.
    So i cannot test that.
    EschieEsh likes this.
  4. EschieEsh
    Offline

    EschieEsh Active Member

    Joined:
    Jun 28, 2014
    Posts:
    69
    Minecraft User:
    Escherion
    It is not your fault, the given example is not correct for SQLite3

    Both of you, take a look at this : https://bugs.php.net/bug.php?id=49303
    Last edited: Aug 8, 2016
    SOFe likes this.
  5. EschieEsh
    Offline

    EschieEsh Active Member

    Joined:
    Jun 28, 2014
    Posts:
    69
    Minecraft User:
    Escherion
    Why don't you try with SELECT COUNT(*) instead of SELECT name?
    0 will be returned if the table doesn't exist and 1 if it does.
    SOFe likes this.

Share This Page

Advertisement