Jump to content

Database


papam77

Recommended Posts

function db () 
db = dbConnect( "sqlite", "dbname=zahrej;host=mysql.mmhost.eu", "zahrej", "passwordhhaha", "share=1" ) 
if ( db ) then 
outputChatBox ( "Connected" ) 
else 
outputChatBox ( "Something went wrong" ) 
end 
end 
addCommandHandler ("database", db ) 

Why it doesn't show me in chat if is work?

Link to comment

One thing you would have to avoid is using the same function name as the variable name.

Make sure this is server-sided.

Try this:

function dbFunc() 
    local db = dbConnect( "sqlite", "dbname=zahrej;host=mysql.mmhost.eu", "zahrej", "passwordhhaha", "share=1" ) 
    if ( db ) then 
        outputChatBox ( "Connected" ) 
    else 
        outputChatBox ( "Something went wrong" ) 
    end 
end 
addCommandHandler ("database", dbFunc ) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...