WASSIm. Posted July 13, 2014 Posted July 13, 2014 hi guys, i working for Sqlite browser panel but i don't know get all data from sql with tables please if anyone know it tell me
_DrXenon Posted July 13, 2014 Posted July 13, 2014 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
Moderators Citizen Posted July 13, 2014 Moderators Posted July 13, 2014 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
#DRAGON!FIRE Posted July 14, 2014 Posted July 14, 2014 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
WASSIm. Posted July 14, 2014 Author Posted July 14, 2014 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)
Mr_Moose Posted July 14, 2014 Posted July 14, 2014 You have SELECT * SHOW TABLES in your code, it should only be SHOW TABLES if you want to list all tables in your database.
WASSIm. Posted July 15, 2014 Author Posted July 15, 2014 debug show me this: dbPoll failed near "SHOW": syntax error
Saml1er Posted July 15, 2014 Posted July 15, 2014 "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"
Arnold-1 Posted July 15, 2014 Posted July 15, 2014 i don't have a huge knowledge about SQL, but i think "SELECT * FROM *" would work to get ALL the data.
Mr_Moose Posted July 15, 2014 Posted July 15, 2014 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now