Jump to content

dbQuery insert into table fails


DLmass

Recommended Posts

Posted

Hi guys. I'm kinda stuck at this little thing underneath this line. It just won't insert into accounts table.

dbQuery( connection, "INSERT INTO accounts (username,password,money,skin,posx,posy,posz,rot,int,dim,health,armor) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)", username, sha256, 2000, math.random(7,288), 1653.67, -1657.99, 22.51, 178, 0, 0, 100, 100) 

Please help me with this!

kind regards,

DLmass

  • MTA Team
Posted

no error? "just doesn't work"?

fyi, if yo on mac:

cmd+space to open spotlight

type Terminal

press enter

# THIS LINE HERE MAY BE WRONG. IF YOU TYPE "ls" IT WILL LIST THE DIRECTORY CONTENTS

# YOU CAN TYPE "cd" repeatedly instead of all at once

type: "cd /Applications/Multi Theft Auto.app/Contents/Resources/drive_c/Program\ Files/MTA\ San\ Andreas\ 1.3/"

# THIS SETS PERMISSIONS FOR ALL CONTENTS OF THE CURRENT FOLDER (cd = change directory)

type: "chmod 777 -R ./"

the mta dir may be wrong.

Posted

No error, theres nothing showing up. So yeah I'm confused..

btw, it's on linux debian!

But if I use this it works like a charm!

dbQuery( connection, "INSERT INTO accounts (username,password) VALUES(?,?)", username, sha256) 

  • MTA Team
Posted

okay just navigate to your deathmatch folder

try "chmod 755 internal.db" and if it still doesnt work try 777

Posted
[17:07:36] WARNING: @[gamemode]/accounts/login_server.lua:96: dbExec failed; (10 
64) You have an error in your SQL syntax; check the manual that corresponds to y 
our MySQL server version for the right syntax to use near 'int, dim, health, arm 
or) VALUES ('d', '3F39D5C348E5B79D06E842C114E6CC571583BBF44' at line 1 
 

I got this error

  • MTA Team
Posted

fyi in phpmyadmin if you do an insert, it'll show you the generated sql after you press okay (before you press CONFIRM)

Posted

I've noticed something. If I use under VALUES 10 it works but over VALUES 10 it fails

This works

dbExec( connection, "INSERT INTO accounts (username,password,health,armor,skin,money,posx,posy,posz,rot) VALUES (?,?,?,?,?,?,?,?,?,?)", username,sha256,health,armor,skin,money,posx,posy,posz,rot) 

This didn't work

dbQuery( connection, "INSERT INTO accounts (username,password,money,skin,posx,posy,posz,rot,int,dim,health,armor) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)", username, sha256, 2000, math.random(7,288), 1653.67, -1657.99, 22.51, 178, 0, 0, 100, 100) 

This works

dbQuery( connection, "INSERT INTO accounts (username,password) VALUES(?,?)", username, sha256) 

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