Sql INSERT INTO Error
#1

Hi everyone i am using this function

Код:
	new Query[308];
	format(Query, sizeof Query, "INSERT INTO vehicles (ownername, price, model) VALUES ('%q', %d, %d)", "NONE", vehicleInfo[vid][vprice], vehicleInfo[vid][vmodel]);
	db_query(VehDB, Query);
it gives me this error i dont know what the error means can anyone explains it to me :

[Error] db_query: invalid database handle 0
Reply
#2

db_query(VehDB, Query); here must be your SQL handle, which you created when you was connecting to MySQL (for example: mydb = mysql_connect(... )
also this must be created with MySQL tag (new MySQL:mydb; )
Reply
#3

i am using sqlite not mysql
Reply
#4

agh, my bad, problem is same.
you have to use new DB:mydb;
and mydb = db_open(...
db_query(mydb,Query);
Reply
#5

opps my bad i created vehicles before opening the database under OnGameModeInit thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)