Jump to content

MYSQL Problem


Luk-ry

Recommended Posts

Posted (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 by Guest
Posted

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.

MTASA.LV - Latvian MTA Community

Posted

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

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
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

Posted

can i ask how you created it? its on dedicated hosting on installed on your local pc?

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

and how you have created database? via command line or some kind of database managing app?

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

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 :)

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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