help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Goofy

    help

    Hi,

    i am having trouble getting sopmething simple working -a administration
    function where u can add topic and i cant see why.when i do to add a topc it
    shows me the message Error!. - 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 '' at line 1

    the code i am running is this

    <?php

    if (isset($Submit) ) {
    $dbcnx = @mysql_connect ("localhost" , "username", "password") ;

    if (!$dbcnx) {
    echo ("<p>Unable to connect to the SQL Server at this time.</p>");
    exit();
    }

    if (!@mysql_select _db("Pdcs2ga_ga me")) {
    echo ("<p>Unable to locate the Pdcs2ga_game Database at this
    time.</p>");
    exit();
    }


    $sql = "INSERT INTO `Topic` (`name') VALUES ('$topic')";
    $result = @mysql_query ($sql);
    if ($result) {
    echo ("The topic has been added.");
    } else {
    echo ("Error!. - " . mysql_error());
    }

    }


    ?>


  • Pieter Nobels

    #2
    Re: help

    Goofy wrote:[color=blue]
    > Hi,
    >
    > i am having trouble getting sopmething simple working -a administration
    > function where u can add topic and i cant see why.when i do to add a topc it
    > shows me the message Error!. - 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 '' at line 1
    >
    > the code i am running is this
    >
    > <?php
    > $sql = "INSERT INTO `Topic` (`name') VALUES ('$topic')";
    > ?>[/color]

    This should be:
    $sql = "INSERT INTO `Topic` (`name`) VALUES ('$topic')";
    ^

    --
    Pieter Nobels

    Comment

    • Goofy

      #3
      Re: help


      ? "Pieter Nobels" <pieterRE@MOVEp cmania.be> ?????? ??? ??????
      news:Ql6Qc.2032 03$Rd4.10368142 @phobos.telenet-ops.be...[color=blue]
      > Goofy wrote:[color=green]
      > > Hi,
      > >
      > > i am having trouble getting sopmething simple working -a administration
      > > function where u can add topic and i cant see why.when i do to add a[/color][/color]
      topc it[color=blue][color=green]
      > > shows me the message Error!. - You have an error in your SQL syntax.[/color][/color]
      Check[color=blue][color=green]
      > > the manual that corresponds to your MySQL server version for the right
      > > syntax to use near '' at line 1
      > >
      > > the code i am running is this
      > >
      > > <?php
      > > $sql = "INSERT INTO `Topic` (`name') VALUES ('$topic')";
      > > ?>[/color]
      >
      > This should be:
      > $sql = "INSERT INTO `Topic` (`name`) VALUES ('$topic')";
      > ^
      >
      > --
      > Pieter Nobels[/color]

      thank u very much. i had written wrong this symbol and couldnt find why.
      and something else. when i add the topic it shows me the message the topic
      was added in the beggining of the page and i want to appear under the button
      topic. how should do that?


      Comment

      Working...