Jump to content

Question SQL


WASSIm.

Recommended Posts

Posted

i am also new for SQL thingy...

but i used:

executeSQLQuery("SELECT * FROM sqldataName ( column, column) ")

or something like that, anyway you may also check wiki.multitheftauto.com

 

●●●

Rage Gaming Society

Coming Soon

●●●

  • Moderators
Posted
i am also new for SQL thingy...

but i used:

executeSQLQuery("SELECT * FROM sqldataName ( column, column) ")

or something like that, anyway you may also check wiki.multitheftauto.com

The syntax is wrong, you probably meant:

SELECT * FROM tableName 

And it will return all rows and columns from a table with the name "tableName"

But before that you probably 1st want to list all tables from the database you are connected on:

SHOW TABLES 

And if you need to list databases:

SHOW DATABASES 

The rEvolution is coming ...

Posted

function returnAllData (   ) 
  local data = executeSQLQuery( "SELECT * FROM SQL" ) 
   if ( #data > 0 ) then 
      local table = {   } 
      for _,alldata in ipairs( data ) do 
           table.insert( table, alldata ) 
       end 
   end 
  return table 
end    

To Contact Me at Skype : [email protected]

Posted

i use sqlite with dbConnect and SHOW TABLES not working

addEventHandler("onResourceStart", resourceRoot, 
function ( ) 
    connection = dbConnect("sqlite", "database.db") 
    if (connection) then 
        outputDebugString("Successfully connected to database.db") 
    else 
        outputDebugString("Failed to connect to database.db", 3) 
    end 
end) 
  
addEvent("onPlayerLoadDatabase", true) 
addEventHandler("onPlayerLoadDatabase", root, 
function( ) 
    local query = dbQuery(connection, "SELECT * SHOW TABLES") 
    local data =  dbPoll(query, -1) 
    triggerClientEvent(source, "onClientPlayerLoadDatabase", source, data) 
end) 

Omerta Roleplay

Posted
"SELECT * SHOW TABLES" 

As you can see here you have spaces SHOW TABLES. Not sure but I don't think so you can use spaces and it should be

"SELECT * FROM MyTableName" 

Posted

i don't have a huge knowledge about SQL, but i think "SELECT * FROM *" would work to get ALL the data.

Ingame Name: Arnold

If you need my help, contact me on Skype @bshr.ara

NOTE:DO NOT ASK ME FOR SCRIPTS, ASK ME FOR HELP

Posted

It depends on what type of database you have, some say SQL even when they mean SQLite for instance, here's the syntax for all major databases:

MySQL 
SHOW [FULL] TABLES [FROM db_name] [LIKE 'pattern'] 
  
Oracle 
SELECT * FROM dba_tables 
  
MSSQL 
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' 

SQLite is like MySQL basically.

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