Jump to content

Creating table in MySQL?


Jockie

Recommended Posts

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

Link to comment

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

Link to comment

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