Jump to content

[HELP] Getting value from MySQL Database


Azaroth

Recommended Posts

It's connected with mysql_connect.

handler = mysql_connect("localhost", "root", "pass", "multi theft auto") 

@EDIT:

Ok. Connected with DbConnect and got values with dbPoll, but I don't understand that dbPoll. Can someone explain me how it works?

local query = dbQuery( connection, "SELECT * FROM pickups WHERE UID="..i) 
local result, numrows, errmsg = dbPoll ( query, -1 ) 
  
if numrows > 0 then 
  
    for result, row in pairs ( result ) do 
        -- by using a second loop (use it if you want to get the values of all columns the query selected): 
        for column, value in pairs ( row ) do 
            -- column = the mysql column of the table in the query 
            -- value = the value of that column in this certain row 
        end 
  
        -- or without a second loop (use it if you want to handle every value in a special way): 
        outputChatBox ( row["column"] ) -- it will output the value of the column "column" in this certain row 
    end 
  
end 

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