Jump to content

[BUG] dbQuery - how to insert auto increment?


Recommended Posts

Hey guys, this is my query:

local createPPQuery = dbQuery(handler, "INSERT INTO PayPhoneOW VALUES (`PosX`,`PosY`,`PosZ`,`Number`)", x, y, z, phonenumber)
				dbFree(createPPQuery)

The error is "Column count doesn't match value count at row 1"
 

if I add ID infront of PosX and also a value for it infront of 'x' then it will work, but ID is auto increment and I don't want to set any value for it when I insert, what is the workaround?

Also 'x', 'y' and 'z' along with the 'phonenumber' doesn't insert anything in the db but if I print them they are okay.

 

Should the query be like this maybe?

local createPPQuery = dbQuery(handler, "INSERT INTO `PayPhoneOW` (`PosX`,`PosY`,`PosZ`,`Number`) VALUES (?,?,?,?)", x, y, z, phonenumber)

if so, then they should update the wiki and add such an example too because I had to guess it myself...

Edited by Dutchman101
Fix topic title for section requirements
Link to comment

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