Jump to content
  • 0

Create Table on Sql?


Question

Posted (edited)

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

1 answer to this question

Recommended Posts

Posted

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;

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...