ULX

Author Topic: SQL: table from string in row?  (Read 62 times)

0 Members and 1 Guest are viewing this topic.

Offline Doomed

  • Newbie
  • *
  • Posts: 27
  • Karma: 0
SQL: table from string in row?
« on: January 15, 2019, 12:49:34 AM »


In MySQL, is there a way to retrieve a table of information (like in the "Classes" column) rather than just a string or integer? It gets stored as a string, I just dont know of any gmod functions that can directly convert a string to a table. thanks
« Last Edit: January 15, 2019, 12:56:27 AM by Doomed »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2667
  • Karma: 417
    • |G4P| Gman4President
Re: SQL: table from string in row?
« Reply #1 on: January 15, 2019, 06:58:41 AM »
That's because MySQL doesn't store data as tables... only has strings or numbers.

You can use the following lua functions to serialize your tables and store/read them from MySQL:

http://wiki.garrysmod.com/page/util/TableToJSON
http://wiki.garrysmod.com/page/util/JSONToTable