Jump to content
  • 0

Create Table on Sql?


PewN

Question


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

how can i make a sql table like create a table on a text my sql.

 id | character id | item_id | quantity 

like this


CREATE TABLE IF NOT EXISTS `guildpack` (
 `id` int(11) NOT NULL auto_increment,
 `account_id` int(11) NOT NULL default '0',
 `name` varchar(23) NOT NULL default '',
 `last_ip` varchar(100) NOT NULL default '',
 PRIMARY KEY (`account_id`),
 KEY (`id`)
) ENGINE=MyISAM;

i already make but i don't know if this is correct


CREATE TABLE IF NOT EXISTS `claimreward` (
 `id` int(11) NOT NULL auto_increment,
 `char_id` int(11) NOT NULL default '0',
 `item_id` int(11) NOT NULL default '',
 `quantity` int(11) NOT NULL default '',
 PRIMARY KEY (`character_id`),
 KEY (`id`)
) ENGINE=MyISAM;

Edited by bVersatile
Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

Put this inside your script somewhere. I wrote this at work and it has not been tested, but I think its okay. So somebody please correct if necessary.

Peopleperson49

function createTable { query_sql("CREATE TABLE IF NOT EXISTS `claimreward` (`id` int(11) NOT NULL auto_increment,`char_id` int(11) NOT NULL default '0',`item_id` int(11) NOT NULL default '',`quantity` int(11) NOT NULL default '',PRIMARY KEY (`character_id`),KEY (`id`) ) ENGINE=MyISAM;

OnInit:
createTable();
end;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...