各位帮忙修改一下这段代码
我找不出来错误CREATE tabale 'Books' `$tabale` ('ChapterId' int(20) auto_increment,
   'ChapterName' varchar(50) not null unique,
   'ChapterUrl' varchar(50) not null unique,
   'PlBookId' int(20) not null,
   PRIMARY KEY ('ChapterId'),
   FOREIGN KEY ('PlBookId') REFERENCES book('BookId')
   )ENGINE = MYISAM

解决方案 »

  1.   

    `$tabale` 为什么有这个啊
    还有表名,字段名一般都不用''这样的吧
      

  2.   

    这个我是用在php文件里的没有改过来
      

  3.   

    先把tabale改了 如果有错误请LZ把错误提示贴出来看看
      

  4.   

    这个是sql的错误提示
    #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 '"CREATE table 'Books' 'asdfsadfa' ( 'ChapterId' int(20) not null auto_incre' at line 1
      

  5.   

    用一个好点的编辑器,能提示关键字的。
    tabale这种错误太低级了。
      

  6.   

    本帖最后由 xuzuning 于 2010-07-30 10:04:25 编辑
      

  7.   

    这是我放在phpmyadmin里运行的语句CREATE TABLE 'Books' 'dsfsadfa'(
    'ChapterId'INT( 20 ) AUTO_INCREMENT ,
    'ChapterName'VARCHAR( 50 ) NOT NULL UNIQUE ,
    'ChapterUrl'VARCHAR( 50 ) NOT NULL UNIQUE ,
    'PlBookId'INT( 20 ) NOT NULL ,
    PRIMARY KEY ( 'ChapterId' ) ,
    FOREIGN KEY ( 'PlBookId' ) REFERENCES book( 'BookId' ) 
    ) ENGINE = MYISAM 
    也报错误
    #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 ''Books' 'dsfsadfa'( 'ChapterId' INT( 20 ) AUTO_INCREMENT , 'ChapterName'VARCHA' at line 1
      

  8.   

    把里面的'全部改成`就是tab键上面的一个
      

  9.   

    哎终于找出毛病来了数据库的编码格式与eclipse的编码格式不一样,在eclipse里写的数据库不认识