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

MySQL

Comments in 'Plugin Development' started by MyNameIsTriXz, Mar 20, 2016.

Thread Status:
Not open for further replies.
  1. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Can you tell me how mysql really works? Need I create a mysql table on php my admin or just by coding? And where can I look up for the table?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PocketKiller and Primus like this.
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Either. You can make table from query and from phpMyAdmin.
  4. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    You were few seconds faster.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I guess I need to write a tutorial about using MySQL in plugins.
    Tim // robske Büba and Primus like this.
  6. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Go ahead. Like from me.
  7. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    My phone is buggy af atm... I am happy that I could even write this thread... before it looses touch
  8. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Where I see the table in web
  9. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    phpMyAdmin >> yourdatabase_name >> yourtable_name >> rows
    MyNameIsTriXz likes this.
  10. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Okay and why do mañy preople use mysqli than mysql?
  11. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
  12. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Connect:
    PHP:
    $this->mysqli= new \mysqli("host""user""Password""Database");
    Create table:
    PHP:
    $this->mysqli->query("CREATE TABLE IF NOT EXISTS `table_name` (
    `name` VARCHAR(255) PRIMARY KEY,
    `kills` INT DEFAULT 0,
    `deaths` INT DEAFULT 0
    )"
    );
    Puts the user in the table:
    PHP:
    $name $event->getPlayer()->getName()
    $sql "INSERT INTO table_name (name) VALUES (?)";
    $eintrag $this->mysqli->prepare($sql);
    $eintrag->bind_param('s'$name);
    $eintrag->execute();
    Sets the kills from a player +1
    PHP:
    $sql "UPDATE table_name SET `kills`=`kills` +1 WHERE name = '$name'";
    $this->mysqli->query($sql);
  13. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    MySQL is the database server name. MySQLi is the PHP extension name that allows connecting to the MySQL server. There was an old PHP extension called MySQL, but it has been long deprecated and is no longer supported as of PHP 7.
  14. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    o.0
  15. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Actually I find phpmyadmin quite useless. If you know what MySQL is about, just a normal MySQL client can already visualize the data in the table.
Thread Status:
Not open for further replies.

Share This Page

Advertisement