Results 1 to 2 of 2

Thread: Problem with newer versions of MySQL

  1. #1
    Join Date
    Aug 2007
    Posts
    2

    Default Problem with newer versions of MySQL

    Hi.

    I've my website running on MySQL 4.1.21-community-nt and we're planning a database upgrade to MySQL 5.x, mostly because the stored procedures and triggers features.

    However, doing some local tests, I found out that there seems to be a problem with MySQL 5.0.x, 5.1.x and 6.x

    Basically, I'm trying to execute the following code:

    PHP Code:
    $idtoken=$_POST['idtoken'];
    $sql="UPDATE TOKEN SET NOMBRE='".$_POST['nombre']."', LEYENDA='".$_POST['leyenda']."', CONTENIDO='".$_POST['contenido']."', AREA=".$_POST['area'].", FUENTE='".$_POST['fuente']."', AUTOR=".$_POST['autor'].", FECHA='".$_POST['fecha']."', WIKITOKEN='".$_POST['wiki']."' WHERE IDTOKEN='$idtoken'"
    The table creation script is the following:

    CREATE TABLE TOKEN (
    IDTOKEN INT NOT NULL,
    NOMBRE TEXT NULL,
    LEYENDA TEXT NULL,
    CONTENIDO TEXT NULL,
    AREA INT NULL,
    FUENTE TEXT NULL DEFAULT NULL,
    AUTOR INT NULL,
    FECHA DATE NULL DEFAULT NULL,
    HITS INT NULL,
    WIKITOKEN TEXT NULL,
    PRIMARY KEY(IDTOKEN),
    INDEX TOKEN_FKIndex1(AREA),
    INDEX TOKEN_FKIndex2(AUTOR)
    );

    I've echoed $idtoken and the variable is showing the expected value.

    The thing is that it works on 4.1.x and not on 5.0.x or newer versions.

    I read somewhere that starting on MySQL 5.0.x there's a revision of the SQL standard (2003 compliance), but I don't know if this has something to do with this.

    Unfortunalety, if I don't solve this problem, we cannot perform our database upgrade, and since on version 6.0 won't work, there may be a long way to go.

    Am I having some stupid syntax error? is there a new PHP syntax?, is there some MySQL trick?, please, help!


    Thanks.



    By the way, I'm using PHP 5.2.3

  2. #2
    Join Date
    Aug 2007
    Posts
    4

    Default

    At the end of your query statement you have: WHERE IDTOKEN='$idtoken'";
    Should be WHERE IDTOKEN=".$idtoken;

    Since IDTOKEN is an integer in your table, no quotes are needed around it.

Posting Permissions

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