Stranger Posted August 30, 2014 Share Posted August 30, 2014 hello , i'm working on vehicle shop so i'm trying to make when the vehicle get destroyed the color of the vehicle saved on the sql when i do the UPDATE in the sql so it shows on the database in the color's column the price of the vehicle at each one of the column i've tried so many ways but not one of those ways works with me, so help here is the code: executeSQLQuery ("UPDATE `Vehs` SET `ColorR` = ?, `ColorG` = ?, `ColorB` = ?, `cost` = ? WHERE `Account` = ? AND `Model` = ?", r, g, b, cost, getPlayerAccount (source), id) i guess the problem only here so, Link to comment
'LinKin Posted August 30, 2014 Share Posted August 30, 2014 What error does the debug output? Link to comment
Anubhav Posted August 30, 2014 Share Posted August 30, 2014 executeSQLQuery ("UPDATE `Vehs` SET `ColorR` = ?, `ColorG` = ?, `ColorB` = ?, `cost` = ? WHERE `Account` = ? AND `Model` = ?", r, g, b, cost, tostring(getAccountName(getPlayerAccount (source))), id) Link to comment
'LinKin Posted August 30, 2014 Share Posted August 30, 2014 I see no error on that line, unless the variables you define aren't what you think they are. Re-check them Link to comment
Stranger Posted August 30, 2014 Author Share Posted August 30, 2014 yea thanks, solved. Link to comment
Stranger Posted August 30, 2014 Author Share Posted August 30, 2014 but there is a problem, why in the database if i change the colors of the vehicle, like: 255, 0, 0 it shows on the database like this 3, 0, 0, and if i change it to 0, 255, 0 it shows like: 65, 0, 0 i don't know why !!! Link to comment
'LinKin Posted August 30, 2014 Share Posted August 30, 2014 What are the columns' types that you defined when you created the table? Link to comment
'LinKin Posted August 30, 2014 Share Posted August 30, 2014 (edited) Well, if they are TEXT, then you need to do somethig like: executeSQLQuery ("UPDATE `Vehs` SET `ColorR` = ?, `ColorG` = ?, `ColorB` = ?, `cost` = ? WHERE `Account` = ? AND `Model` = ?", tostring(r), tostring(g), tostring(b), cost, getAccountName(getPlayerAccount (source)), id) EDIT: You don't need tostring(getAccountName(getPlayerAccount (source))) because getAccountName returns a string by default. Edited August 30, 2014 by Guest Link to comment
Anubhav Posted August 30, 2014 Share Posted August 30, 2014 yea thanks, solved. No problem. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now