mysql help [+REP]
#1

i'm working in my own mysql car ownership system
and i got a error
pawn Код:
21:41:58] [DEBUG] mysql_format - connection: 1, len: 200, format: "INSERT INTO `pvehicles` (`vOwner`, `vModel`, `vColor1`, `vColor2`, `vX`, `vY`, `vZ`, `vA`) VALUES(%s, %i, %i, %i, %f, %f, %f, %f..."
[21:41:58] [DEBUG] mysql_query - connection: 1, query: "INSERT INTO `pvehicles` (`vOwner`, `vModel`, `vColor1`, `vColor2", use_cache: true
[21:41:58] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called
[21:41:58] [DEBUG] CMySQLQuery::Execute[()] - starting query execution
[21:41:58] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'Marco_Smith' in 'field list'
here is the problem
pawn Код:
mysql_format(mysql, string, sizeof(string), "SELECT `vOwner` FROM `pvehicles` WHERE `vOwner` = '%s'", name);
mysql_query(mysql, string);
plz help

sorry for my bad english
Reply
#2

It's not in that query but in INSERT instead.

You used %s but you need to use '%s' or even better '%e' (so it escapes strings to avoid SQL Injection).

pawn Код:
INSERT INTO `pvehicles` (`vOwner`, `vModel`, `vColor1`, `vColor2`, `vX`, `vY`, `vZ`, `vA`) VALUES ('%e', %i, %i, %i, %f, %f, %f, %f)
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
It's not in that query but in INSERT instead.

You used %s but you need to use '%s' or even better '%e' (so it escapes strings to avoid SQL Injection).

pawn Код:
INSERT INTO `pvehicles` (`vOwner`, `vModel`, `vColor1`, `vColor2`, `vX`, `vY`, `vZ`, `vA`) VALUES ('%e', %i, %i, %i, %f, %f, %f, %f)
thnx mate it's works repped
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)