Jump to content


Photo

Creating a table


  • Please log in to reply
5 replies to this topic

#1 abhorsen

abhorsen
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 19 August 2006 - 09:10 PM

I am trying to creat a table, after 2 hours of messing about trying to get phpmyadmin to work I gave up and used the program recommened by my hosting company (fasthosts).

This connected in like 2 mins :) but when trying to creat a table, (based of the "Creating a Membership System with PHP and MySQLhttp://www.phpfreaks...orials/40/1.php" on this site)

I get the following syntax error

An error occurred creating the Table. 

Server Error: ERROR: 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 ''1' '2' '3') NOT NULL DEFAULT '0', 
	`signup_date` datetime NOT NULL, 
	`last_lo' at line 10

QUERY: CREATE TABLE `Membership_Information` 
(
	`userid` integer (25) NOT NULL auto_increment, 
	`first_name` varchar (25) NOT NULL, 
	`last_name` varchar (25) NOT NULL, 
	`email_address` varchar (25) NOT NULL, 
	`username` varchar (25) NOT NULL, 
	`password` varchar (25) NOT NULL, 
	`info` text NOT NULL, 
	`user_level` enum('0' '1' '2' '3') NOT NULL DEFAULT '0', 
	`signup_date` datetime NOT NULL, 
	`last_login` datetime NOT NULL, 
	`activated` enum('0' '1') NOT NULL DEFAULT '0', 
	`user_image` varchar (50) NOT NULL, 
	`user_country` varchar (50) NOT NULL,
	PRIMARY KEY (`userid`)
) TYPE=MyISAM

AS far as i can tell when compearing the code to that in the how to gude it looks right, but beeign stuck using http://www.dbtools.com.br/EN/index.php I can not tell if there is something else i am missing out.

http://www.thingstod...co.uk/error.jpg screen shot, just incase soem one can see some thing i am missing, thanks in advance.


#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 19 August 2006 - 10:02 PM

You need to separate each of the ENUM values with a comma NOT a space
Legend has it that reading the manual never killed anyone.
My site

#3 abhorsen

abhorsen
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 19 August 2006 - 10:27 PM

thanks for the help, that seems to have worked in so much as the error has now changed.

Executing Query. Wait ...
MySQL ERROR:

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 'QUERY: CREATE TABLE users (
	`userid` INT (25) NOT NULL,
	`first_name` varchar (' at line 1

QUERY:

QUERY: CREATE TABLE users (
	`userid` INT (25) NOT NULL,
	`first_name` varchar (25) NOT NULL DEFAULT ' ',
	`last_name` varchar (25) NOT NULL DEFAULT '',
	`email_address` varchar (25) NOT NULL DEFAULT '',
	`username` varchar (25) NOT NULL DEFAULT '',
	`password` varchar (255) NOT NULL DEFAULT '',
	`info` text NOT NULL,
	`user_level` enum('0','1','2','3') NOT NULL DEFAULT '0',
	`signup_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
	`last_login` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
	`activated` enum('0','1') NOT NULL DEFAULT '0',
	`user_image` varchar (50) NOT NULL DEFAULT '',
	`user_country` varchar (50) NOT NULL DEFAULT '',
	PRIMARY KEY (`userid`)
) TYPE=MyISAM comment='Membership information'


#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 20 August 2006 - 12:11 AM

I see nothing wrong with that.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#5 abhorsen

abhorsen
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 20 August 2006 - 08:01 AM

nether can I, will ahve to ahve a play with myphpadmin and see if ic an get that to connect, the main prolbem i am having with that is that my web hosting is on seprate server to my sql server, so my phpadmin is not really likeing it :( thanks for the help any way.

#6 abhorsen

abhorsen
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 20 August 2006 - 09:16 AM

Guys thanks to thouse who offered help, I sat back down this morning and just did exactly the same thing as i did yesterday, but it worked the code looks the same and every thing, I havent a clue as to why i was having so much trouble but thanks for the help any way at least I have table now, now for the hard part :).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users