Luk-ry Posted August 8, 2010 Posted August 8, 2010 (edited) I have a problem with my script: function sqlgetaccountinfo(playerSource) playername = getPlayerName( playerSource ) database = mysql_connect ("localhost", "root", "*****", "mta san andreas accounts") isNameSQL = mysql_query ( database, "SELECT * FROM name" ) outputChatBox ("x"..tostring(isNameSQL).."x", playerSource) isTableCreated = mysql_query ( database, "CREATE TABLE playername(user char (20) );") outputChatBox("x"..tostring(isTableCreated).."x", playerSource) end addCommandHandler("x", sqlgetaccountinfo) It only makes a table with the name playername. How can I make that it writes the player name into the table? PS:Sorry for my bad english Edited August 8, 2010 by Guest
The_Ex Posted August 8, 2010 Posted August 8, 2010 mysql_query ( database, "INSERT INTO playername VALUES ('"..playername.."')") Should be something like that if i got you right... Just learn SQL, you wouldn't have those questions if you had spent some time to learn SQL statements.
dzek (varez) Posted August 8, 2010 Posted August 8, 2010 i think you dont understand SQL at all for table creating its better to use CREATE TABLE IF NOT EXIST ... and are you sure you need MySQL? SQLite should be enough for most uses, only for advanced things you need MySQL. btw: you called your database "mta san andreas accounts"? And it's working??
Luk-ry Posted August 8, 2010 Author Posted August 8, 2010 i think you dont understand SQL at allfor table creating its better to use CREATE TABLE IF NOT EXIST ... and are you sure you need MySQL? SQLite should be enough for most uses, only for advanced things you need MySQL. btw: you called your database "mta san andreas accounts"? And it's working?? Yes, the database is working
dzek (varez) Posted August 8, 2010 Posted August 8, 2010 can i ask how you created it? its on dedicated hosting on installed on your local pc?
dzek (varez) Posted August 8, 2010 Posted August 8, 2010 and how you have created database? via command line or some kind of database managing app?
Luk-ry Posted August 8, 2010 Author Posted August 8, 2010 database managing app: http://www.heidisql.com/
dzek (varez) Posted August 8, 2010 Posted August 8, 2010 free one, nice. i used 3 applications and im still sure phpMyAdmin is best for it (but it require www server with php).. okay, end of this little offtopic
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