ERROR could not update your products model field length.

Discussion in 'MySQL' started by horseygirl, Oct 9, 2009.

  1. #1
    im installing a script and part of the install.php does table creation etc.

    i get this error

    ERROR could not update your products model field length.

    this is the line from in the install file, note it does create about 5 tables before it gets this error

    $sql = 'ALTER TABLE `products` CHANGE `products_model` `products_model` VARCHAR(24) NULL DEFAULT NULL';
    if (db_query($sql)){echo "<br> Successfuly updated your products model field length <br>";}else{
    echo "<font color=red > <br> ERROR: could not update your products model field length </font><br>";
    }

    any help welcomed
     
    horseygirl, Oct 9, 2009 IP
  2. Natashalein

    Natashalein Peon

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can you post me the whole code that i can see what structure the altered table has ?
     
    Natashalein, Oct 14, 2009 IP
  3. phones2me

    phones2me Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ALTER TABLE is failing

    what is the current table definition of 'products_model'?

    show desc products_model
     
    phones2me, Oct 14, 2009 IP
  4. Natashalein

    Natashalein Peon

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I need the structure of the table that has to be altered^^.
     
    Natashalein, Oct 14, 2009 IP
  5. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #5
    The query is fine. I believe products table does not have products_model column or possibly wrong database is chosen for query..

    Please modify a code little for debug purpose like this.

    
    $sql = 'ALTER TABLE `products` CHANGE `products_model` `products_model` VARCHAR(24) NULL DEFAULT NULL'; 
    if (db_query($sql))
    {
    	echo "<br> Successfuly updated your products model field length <br>";
    }
    else
    {
    	echo "<font color=red > <br> ERROR: could not update your products model field length </font><br>";
    	echo mysql_errno() . ": " . mysql_error(). "\n";
    }
    
    PHP:
     
    mastermunj, Oct 20, 2009 IP