Jump to content

Azaroth

Members
  • Posts

    18
  • Joined

  • Last visited

Azaroth's Achievements

Square

Square (6/54)

0

Reputation

  1. Solved. Query can't SELECT Float values.
  2. I think that there is a problem with Query, because when I write another Query then it works. local query = dbQuery(connection, "SELECT * FROM `pickups` WHERE `UID`=40" Works. local query = dbQuery(connection, "SELECT * FROM `pickups` WHERE `posX`=?", tostring(positionX)) Didn't work...
  3. Source - player who clicked lalt. This code gets values from selected row from database, but here it didn't work.
  4. Oh... My first post is wrong... Was thinking about something else and wrote bad post. I want to get positions to teleport from database. function Enter() local ColSphere = getElementsByType ( "colshape" ) for i, Sphere in ipairs(ColSphere) do local positionX, positionY, positionZ = getElementPosition ( Sphere ) tempSphere = createColSphere ( positionX, positionY, positionZ, 2 ) if isElementWithinColShape ( source, tempSphere ) then local query = dbQuery( connection, "SELECT * FROM pickups WHERE posX="..tostring(positionX) ) local result, numrows, errmsg = dbPoll ( query, -1 ) for result, row in pairs ( result ) do setElementPosition(source, row["posX"], row["posY"], row["posZ"]) outputChatBox(row["posX"]) end end end end addEvent( "Enterb", true ) addEventHandler( "Enterb", getRootElement(), Enter)
  5. Ok. Udało mi się pobrać, ale mam inny problem... Próbuję pobrać dane pickup'a z bazy danych, który jest w tym samym miejscu co sfera. local ColSphere = getElementsByType ( "colshape" ) for theKey,Sphere in ipairs(ColSphere) do if isElementWithinColShape ( source, Sphere ) then local posX, posY, posZ = getElementPosition ( Sphere ) local query = dbQuery( connection, "SELECT * FROM pickups WHERE posX="..posX ) local result, numrows, errmsg = dbPoll ( query, -1 ) if numrows > 0 then for result, row in pairs ( result ) do for column, value in pairs ( row ) do end outputChatBox(row["model"]) end end end end
  6. It works without if, but I need to use that... Is there another way to get values from database? if isElementWithinColShape ( source, Sphere ) then
  7. Server is connected to database. Other queries works.
  8. I can't use /debugscript.
  9. Hello. I used dbPoll to get checkpoint model from database, but it works only to line: 7. Tried with outputChatBox(posX). local ColSphere = getElementsByType ( "colshape" ) for theKey,Sphere in ipairs(ColSphere) do if isElementWithinColShape ( source, Sphere ) then local posX, posY, posZ = getElementPosition ( Sphere ) local query = dbQuery( connection, "SELECT * FROM pickups WHERE posX="..posX ) local result, numrows, errmsg = dbPoll ( query, -1 ) if numrows > 0 then for result, row in pairs ( result ) do for column, value in pairs ( row ) do end outputChatBox(row["model"]) end end end end
  10. Nie działa. Wartość zmiennej to nil... Wiki też dużo nie mówi jak pobrać wartość.
  11. 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
  12. local query = dbQuery( handler, "SELECT * FROM pickups" ) It's not working. I get warning: Bad argument @ 'dbQuery' [Expected db-connection at argument 1, got userdata]
  13. Hello. How to get value from MySQL Databasa? I tried mysql_query and mysql_fetch_field. mysql_query returns: MySQL result (#32) and mysql_fetch_field return field name.
×
×
  • Create New...