Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
| Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 9th, 2003, 07:33 AM
Registered User
 
Join Date: Dec 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default CREATE TABLE error in MySQL

i am trying to create a table in a mySQL database:

CREATE TABLE mailinglist_ger (
id int(16) NOT NULL auto_increment,
username varchar(64) NOT NULL default'',
domain varchar(64) NOT NULL default'',
PRIMARY KEY(id)
)TYPE=MyISAM;

And I get the following error:

MySQL said:

You have an error in your SQL syntax near '\'\', domain varchar(64) NOT NULL default\'\', PRIMARY KEY(id) )TYPE=MyISAM' at line 3

But their are no backslashes?????

Please could you help... I am really really stuck
  #2 (permalink)  
Old December 9th, 2003, 09:24 AM
Authorized User
 
Join Date: Sep 2003
Location: Cambridge, , United Kingdom.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I presume by leaving the speach marks blank you intend on setting the default on being blank? Is this the case? Well as you state the type should be not null, try putting a space between your ' ' marks. It is not ideal but it works (I checked it using MySQL 4.0.16)

HTH

---
David Thorne, Student
UK
  #3 (permalink)  
Old December 9th, 2003, 01:05 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Also, you should probably have a space between default and ''. I don't know offhand if the lack of space causes problems for the query parser.



Take care,

Nik
http://www.bigaction.org/


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create generic XSL Template to create table Venkatachalapathy XSLT 5 March 11th, 2008 07:49 AM
CREATE TABLE syntax error RaCheer SQL Language 1 January 29th, 2006 01:46 AM
create CSV flat file from mysql table pb MySQL 1 September 21st, 2005 10:51 AM
Create table statement syntax error in access 2000 method Access 1 August 8th, 2005 02:10 AM
$sql="CREATE TABLE syntax error cedtech23 Beginning PHP 3 August 24th, 2004 04:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.