Search code examples
phpmysqlsqlcreate-tableinsert-into

One Table is not being created other is being created


I am working on creating table in to my database with mysql and here is my code:

mysqli_query($link, "CREATE TABLE IF NOT EXISTS `review` (
            `clients_id` int(15) NOT NULL AUTO_INCREMENT,
            `client_id` varchar(150) NOT NULL DEFAULT '',
            `rating` tinyint(2) NOT NULL DEFAULT '0',
            `proj_date` date NOT NULL DEFAULT '0000-00-00',
            `proj_desc` text NOT NULL DEFAULT '',
            `photoname` text NOT NULL,
            `companyname` text NOT NULL,
            `feedback` text NOT NULL,
            `status` tinyint(1) NOT NULL DEFAULT '0',
            `emailid` varchar(100) NOT NULL DEFAULT '',
            `customratings` varchar(100) NOT NULL DEFAULT '',
            `photo_option` varchar(100) NOT NULL DEFAULT '',
            `title` varchar(100) NOT NULL DEFAULT '',
            `citation` varchar(100) NOT NULL DEFAULT '',
            `date_option` varchar(100) NOT NULL DEFAULT '',
            `rating_option` varchar(100) NOT NULL DEFAULT '',
            PRIMARY KEY (`clients_id`),
            FULLTEXT KEY `feedback` (`feedback`)
            ) ENGINE=MyISAM  AUTO_INCREMENT=1") or mysqli_error($link);

But this is not reflecting into my database ? Why were I may be going wrong ?

but I tried creating other table with the following code

mysqli_query($link, "CREATE TABLE IF NOT EXISTS `setting` (
            `id` int(11) NOT NULL auto_increment,
            `script_url` text NOT NULL,
            `date` varchar(4) NOT NULL,
            `rateing` varchar(4) NOT NULL,
            `photo` varchar(4) NOT NULL,
            `dateformat` varchar(4) NOT NULL,
            `page_limit` int(4) NOT NULL,
            `proj_desc` varchar(4) NOT NULL,
            `companyname` varchar(4) NOT NULL,
            `text_color` varchar(255) NOT NULL,
            `citation_color` varchar(255) NOT NULL,
            `bg_color` varchar(255) NOT NULL,
            `border_color` varchar(255) NOT NULL,
            `ratingsformat` varchar(250) NOT NULL,
            `rating` varchar(250) NOT NULL,
            `customratings` varchar(250) NOT NULL,
            `speed` varchar(250) NOT NULL,
            `pagination` varchar(250) NOT NULL,
            `version` varchar(250) NOT NULL,
            `global_option` varchar(250) NOT NULL,
            PRIMARY KEY  (`id`)
            ) ENGINE=MyISAM AUTO_INCREMENT=0;
        ") or mysqli_error($link);

it is being created correctly and both the tables are in the same file


Solution

  • This worked for me but I don't know how?

    I just removed DEFAULT '' present while creating review table and table just got created Here is edited code

    mysqli_query($link, "CREATE TABLE IF NOT EXISTS `review` (
                `clients_id` int(15) NOT NULL AUTO_INCREMENT,
                `client_id` varchar(150) NOT NULL,
                `rating` tinyint(2) NOT NULL,
                `proj_date` date NOT NULL,
                `proj_desc` text NOT NULL,
                `photoname` text NOT NULL,
                `companyname` text NOT NULL,
                `feedback` text NOT NULL,
                `status` tinyint(1) NOT NULL,
                `emailid` varchar(100) NOT NULL,
                `customratings` varchar(100) NOT NULL,
                `photo_option` varchar(100) NOT NULL,
                `title` varchar(100) NOT NULL,
                `citation` varchar(100) NOT NULL,
                `date_option` varchar(100) NOT NULL,
                `rating_option` varchar(100) NOT NULL,
                PRIMARY KEY (`clients_id`),
                FULLTEXT KEY `feedback` (`feedback`)
                ) ENGINE=MyISAM  AUTO_INCREMENT=1") or mysqli_error($link);