Jump to content

mysql error script.


Chris!i!

Recommended Posts

local sql =  dbConnect( "mysql", "dbname=ingame;host=127.0.0.1;port=22003", "root", "24835100a") 
  
  
dbExec ( sql, "CREATE TABLE IF NOT EXISTS selling ( userid TEXT, item TEXT, amount NUMBER, price NUMBER )" ) 
  
  
function getConnection() 
    return sql 
end 
  
function query(...) 
    if isElement(sql) then 
        local qh = dbQuery(sql,...) 
        return dbPoll(qh,-1) 
    end 
    return false 
end 
  
function querySingle(str,...) 
    if not str:find("LIMIT 1") then 
        str = str.." LIMIT 1" 
    end 
    local result = query(str,...) 
    if result then 
        return result[1] 
    end 
    return false 
end 
  
function exec(str,...) 
    if isElement(sql) then 
        return dbExec(sql,str,...) 
    end 
    return false 
end 
  
function doesColumnExist(aTable,column) 
    local theTable = query("DESCRIBE `??`",aTable) 
    if theTable then 
        for k, v in ipairs(theTable) do 
            if v.Field == column then 
                return true 
            end 
        end 
    end 
    return false 
end 
  
function creatColumn(aTable,aColumn,aType) 
    if aTable and column and aType then 
        return exec("ALTER TABLE `??` ADD `??` ??",aTable,aColumn,aType) 
    end 
end 
  

WARNING: mysql.lua:4: Bad argument @ 'dbExec' [Expected db-connection at argument 1, got boolean]

This script is preventing another scripts to not work, please i need help.

Link to comment

Do you have the MySQL server installed and and started? Do you have the database created and a user that can access and/or modify that database? Normally you should check the 'sql' (bad choice of naming though!!!) against NULL values to be sure you have a working connection before you even try anything else. Validate things people! You're working with a weakly typed language.

Link to comment

Why are you connecting via port 22003? The default MySQL port is 3306 - use that instead.

Also, this code looks so damn familiar. In fact, it's line for line exactly the same as CSG's. That's reverse engineering to a whole new level!

Link to comment

We don't have an database account @S.L.C

We are trying to make one but ok listen, i'll explain everything here.

We bought our vps from ovh.com

They gave us our control panel info ONLY.

And to create a database account we need to create another account, and we cant use our control panel account, i created another account for managing and creating a database account but the problem is that the new account doesnt have anything... like our vps to edit it or manage it.. So we got a big problem stuck on this for 6 days, we got a person who knows in database and he couldnt make it since he needs our

database name

database hostname

database password

And we dont have any of these

So we are trying to link those 2 accounts so we can host a database on our vps, but couldnt fuck this

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...