Jump to content

Creating table in MySQL?


Jockie

Recommended Posts

Posted

I'm currently stuck with a tiny problem, I want to save every race map name into the database with accountname+stats.

But the thing is, it does nothing. :o

No errors in the debugscript, no overheaded data at database.

fullname = "test" -- fullname is the name of the map(from a map table) 
--MySQL > Connection to the database, that works. ;D 
  
mysql_query( MySQL, "CREATE TABLE '<databasename>."..fullname.."' ( id INT( 11 ) NOT NULL , name VARCHAR( 255 ) NOT NULL , latest VARCHAR( 255 ) NOT NULL , played VARCHAR( 255 ) NOT NULL , won VARCHAR( 255 ) NOT NULL , latest1 VARCHAR( 255 ) NOT NULL , played1 VARCHAR( 255 ) NOT NULL , won1 VARCHAR( 255 ) NOT NULL , latest2 VARCHAR( 255 ) NOT NULL , played2 VARCHAR( 255 ) NOT NULL , won2 VARCHAR( 255 ) NOT NULL )") 
mysql_query( MySQL, "ALTER TABLE "..fullname.." ADD PRIMARY KEY ( id )")  
mysql_query( MySQL, "ALTER TABLE "..fullname.." CHANGE id id INT( 11 ) NOT NULL AUTO_INCREMENT  ") 

Posted

check what first mysql_query is returning.

I don't remember how to get error of query in mta but the query is invalid.

also you should create table once, so CREATE TABLE IF NOT EXISTS will be better.

I suggest you to get back to mysql manual.

your table logic isn't good one to. columns like "won" should be int i think.

summary: read manual, re-think that again and rewrite from scratch

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 found the problems, those are the "[", "]", "" and "-" in the name.

Like [DM] Pr0nOoB - Summer Beach

So how to make is saveable and that the "[", "]", "" and "-" will save?

Posted

i dont understand.

first thing that is incorrect is this: "." - you can simply remove it

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