Jump to content

[TUT] MySQL Configure - UPDATED 2012-04-08


Todd

Recommended Posts

  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

  
local connect 
  
addEventHandler("onResourceStart", resourceRoot,function() 
    connect  = dbConnect( "sqlite", "file.db", "", "", "share=0" ) 
    if connect then 
        outputDebugString("Connected to the Database!") 
        local tablec = dbQuery ( connect , "CREATE TABLE IF NOT EXISTS tablename (columna,columnb,columnc)" ) 
        if tablec then 
            outputChatBox("Table Created") 
             
        else 
            outputChatBox("Table couldn't be created!") 
        end 
    else 
        outputDebugString("Couldn't connect to the databse!", 1) 
         
    end 
end) 

This will create a .db file called file.db .

And will create a Table if no table exists.

Link to comment
  • 2 weeks later...

Hi

For connection MySQL with server , think i need 2 files

File is

1.Folder Name << Mysql >> and files << connection.lua , meta.xml , s_mysql.lua >>

2.Folder Name << SQL >> and files << layout.lua , meta.xml mysql.lua >>

in this is really for need 2 files to connection????

Link to comment
  • 4 weeks later...
Hi

For connection MySQL with server , think i need 2 files

File is

1.Folder Name << Mysql >> and files << connection.lua , meta.xml , s_mysql.lua >>

2.Folder Name << SQL >> and files << layout.lua , meta.xml mysql.lua >>

in this is really for need 2 files to connection????

That's what you need for a custom system that relies on exports.

Link to comment
  • 2 weeks later...
  • 3 weeks later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...