Jump to content

db* functions


Recommended Posts


After 1.5 update I was change mysql functions from module to inbuilt functions and have one problem.

dbQuery function works only once and returns a data after start the script. Later? Returns nil and nope, nope, nope.

I've writen function queryUpdate to auto-update row in table.

After use of this, my function query isn't working.

dbQuery(mysql, 'UPDATE `accounts` SET `playerHumanity`=?, `gamePoints`=?, `lastLogin`=?, `premiumPoints`=?, `playerPosition`=?,`playerBlood`=?, `lastIP`=?,`playerGroupID`=?, `playerName`=?, `playerItems`=?, `playerThirsty`=?, `playerPain`=?, `playerHungry`=?, `playerLegs`=?, `playerTemperature`=?, `lastQuitType`=?, `playerModel`=?, `playerEnergy`=?, `playerHands`=?, `playerBleeding`=? WHERE `characterID`=11', "0", "0", "CURRENT_DATE", "0", "93.08;-219.28;1.85;0;0", "12000", "", "0", "dudeks", "|||BANDAGE,1;BANDAGE,1;PAINKILLER,1||", "100", "0", "100", "0", "36.599998474121", "Quit", "73", "100", "0", "0") 

Is it too long? Any solutions?

Edited by Guest
Link to comment

How about if you show us function query? And you can use parameters that are defined with ?.


local qh = dbQuery( connection, "INSERT INTO table_name VALUES (?,?,?)", "aaa", "bbb", 10 ) 
dbFree( qh ) 

Link to comment

I've just updated my first post.

Function query didn't work after queryUpdate that I post in 1st post.

query function is:

function query(query, ret) 
    local query = dbQuery(mysql, query) 
    local result, rows, id = dbPoll(query, -1) 
    if result then 
        if ret then 
            return true, result, rows 
            return true, false, rows 
        outputServerLog("MYSQL ERROR: "..rows.." | "..id) 
        return false, false, false 
    return false, false, false 

And you can use parameters that are defined with ?.

In query function i've not using this, I wrote my gamemode sometime ago and can't use it now.

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