Jump to content

MYSQL Problem


Luk-ry

Recommended Posts

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 by Guest
Link to post

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.

Link to post

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?? :o

Link to post
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?? :o

Yes, the database is working

Link to post

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