SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2004
    Location
    UK
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL syntax error

    hey, im trying to install a advertisment system i fount on my pc awhile back, but i get this error when i go to add the data into the database.

    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 coding for the page its on is

    PHP Code:
    <?php

    include('config.php'); // i think you know what this does :p

    include('connect.php');

    $a date("G:i "); // we set the date in these rows

    $b date("d M");

    $time "$b at $a"// and the time

    $ip $_SERVER['REMOTE_ADDR']; // their ip :)

    $id $_POST['id'];

    $imgurl $_POST['imgurl'];

    $link $_POST['link'];

    mysql_query("INSERT INTO `affiliates` (id,imgurl,link) VALUES ('$id','$imgurl','$link',)");

    // query to insert the advertisment into our database.

    if(mysql_error()) {

    die(
    mysql_error()); // error

    }

    echo 
    "Success, the Banner has been published and will show up onto the site. We have recorded your IP: $ip for security reasons" // success message, also stateing that we record your ip for security big boy stuff :p

    ?>
    What is the problem i can seem to find it out.

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,423
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Have you echo'd the query to your browser window? That's a great place to start.

  3. #3
    SitePoint Enthusiast
    Join Date
    Dec 2004
    Location
    UK
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did but i seem to have lost it. must of took it out by mistake, how would i do that again, sorry for being so stupid i just havnt worked with php in a good few months and then i was not to great.

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $query = "insert .....";

    echo $query;

    looks like you got an extra comma in there.


Bookmarks

Posting Permissions

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