www.webdeveloper.com
Results 1 to 6 of 6

Thread: why my CREATE TABLE command isn't working

  1. #1
    Join Date
    Oct 2011
    Location
    Hamilton, Ontario
    Posts
    74

    why my CREATE TABLE command isn't working

    Code:
    $query="CREATE TABLE fback_input (entry bigint(20) NOT NULL auto_increment,Yes bigint(20) NOT NULL,
                       No varchar(20) NOT NULL,Sortof bigint(20) NOT NULL,Response varchar(20) NOT NULL)";
    @mysql_query($query) or die ('unsuccessful query');
    in the previous parts of this code not posted I connect to the database and each previous command has an 'or die ('sampletext')' thing with it and all the other parts are not throwing any errors, it just keeps stopping at 'unsuccessful query'.. I am using XAMPP.. what am I doing wrong?

  2. #2
    Join Date
    May 2013
    Location
    Surendranagar Gujarat India
    Posts
    55
    CREATE TABLE testInfo (
    testNo integer PRIMARY KEY,
    product varchar(15),
    firmware varchar(15),
    startDate date,
    eta date
    );

    CREATE TABLE products (
    product_no integer PRIMARY KEY,
    name text,
    price numeric

    )



    Kishor Makwana
    Software Engineer
    Insight Softech
    www.insightsoftech.com

  3. #3
    Join Date
    May 2013
    Location
    USA
    Posts
    8
    May be database name is wrong, i watch above quires it is quite well.

  4. #4
    Join Date
    May 2013
    Posts
    119
    Check first database connection query, and then start the update query.

  5. #5
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,152
    Make sure the DB user you are connecting with has the necessary create permission(s).

    Also, maybe you could output mysql_error() as part of your debug info -- either in the die() or before it in an error_log().
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  6. #6
    Join Date
    Jun 2013
    Posts
    11
    First try to execute query on database then try it in php. And check the database connection.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles