Jump to content

sql problem -_-


Best-Killer

Recommended Posts

Posted


 

if ( tostring ( get ( "CONNECTION_TYPE" ) ):lower() == "mysql" ) then 
	outputConsole ( "Attempting to connect as MySQL... Please wait")
	db = dbConnect( "mysql", "dbname="..tostring(get("DATABASE_NAME"))..";host="..tostring(get("MYSQL_HOST"))..";port="..tostring(get("MYSQL_PORT"))..";unix_socket=/opt/lampp/var/mysql/mysql.sock", tostring(get("MYSQL_USER")), tostring(get("MYSQL_PASS")), "share=1;autoreconnect=1" );
elseif ( tostring ( get ( "CONNECTION_TYPE" ) ):lower() == "sqlite" ) then 
	db = dbConnect ( "sqlite", tostring(get("DATABASE_NAME")) .. ".sql" );
else 
	error ( tostring(get("CONNECTION_TYPE")) .. " is an invalid SQL connection -- valid: mysql, sqlite" );
end 

if not db then
	print ( "The database has failed to connect")
	return 
else
	print ( "Database has been connected")
end

function db_query ( ... ) 
	local data = { ... }
	return dbPoll ( dbQuery ( db, ... ), - 1 )
end

function db_exec ( ... )
	return dbExec ( db, ... );
end

dbexe failed, (1064) you have an error in your sql syntax; check the manual that corresponds to your mariaDB server version for the right syntax to use near

 

Posted

The error says its a sql syntax problem... so, the code that you shared here has nothing to do with the sql syntax, its just a code for database connection sharing.

Posted

What operating system is it running on? Are you sure you are using XAMPP? If so, that's for Windows, but the unix socket you are using is related to Linux and that is LAMP. 

Posted

Okay, then get rid of the "unix_socket = ..." thing, because that's for Linux and most of the times you don't need to specify that at all anyway.

Posted

Okay, you didn't actually say much about the error. Screenshot the error you are getting because you just left out the most important part, the part after "near". Also you have an error in the dbExec but I see no dbExec commands, just the function for it. Send us that dbExec command you are getting the error from along with the full error message. 

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