Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Creating table using query
Old 02-27-2008, 08:57 AM Creating table using query
Novice Talker

Posts: 7
Trades: 0
Hello, I am trying to create a table in my database using a query, but it is not working. Here is the query:

Code:
CREATE TABLE `pastebin` (
      `pid` int(11) NOT NULL auto_increment,
      `poster` varchar(16) default NULL,
      `posted` datetime default NULL,
      `code` text,
      `parent_pid` int(11) default '0',
      `format` varchar(16) default NULL,
      `codefmt` mediumtext,
      `codecss` text,
      `domain` varchar(255) default '',
      `expires` DATETIME,
      `expiry_flag` ENUM('d','m', 'f') NOT NULL DEFAULT 'm',
 
      PRIMARY KEY  (`pid`),
      KEY `domain` (`domain`),
      KEY `parent_pid`,
      KEY `expires`
    );
 
create table recent
(
    domain varchar(255),
    pid int not null,
    seq_no int not null,
 
    primary key(domain,seq_no)
);
When I try putting that in phpmyadmin SQL query box, it returns:

Quote:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '
KEY `expires`
)' at line 16
What am I doing wrong? If I am not able to do this through phpmyadmin, how would I go about doing this using a .php file? I have tried doing this many times using guides, with no luck, so I would appreciate it if someone could help me.
pkallberg21 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-27-2008, 04:50 PM Re: Creating table using query
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
KEY `parent_pid` (`parent_pid`),
KEY expires (`expires`)

supply a index name AND a column to be used.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-27-2008, 10:51 PM Re: Creating table using query
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
Quote:
Originally Posted by pkallberg21 View Post
What am I doing wrong? If I am not able to do this through phpmyadmin, how would I go about doing this using a .php file? I have tried doing this many times using guides, with no luck, so I would appreciate it if someone could help me.
That's because the database engine is rejecting the code; it won't matter how you send the commands.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Reply     « Reply to Creating table using query
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14056 seconds with 12 queries