Jump to content

Archived

This topic is now archived and is closed to further replies.

abhorsen

Creating a table

Recommended Posts

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 MySQL[url=http://www.phpfreaks.com/tutorials/40/1.php]http://www.phpfreaks.com/tutorials/40/1.php[/url]" on this site)

I get the following syntax error

[code]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
[/code]

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

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

Share this post


Link to post
Share on other sites
You need to separate each of the ENUM values with a comma NOT a space

Share this post


Link to post
Share on other sites
thanks for the help, that seems to have worked in so much as the error has now changed.

[code]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'[/code]

Share this post


Link to post
Share on other sites
I see nothing wrong with that.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 :).

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.