Help Problem with mysql

Discussion in 'MySQL' started by crazycjcool1, Dec 17, 2008.

  1. #1
    hey i was trying to edit a advertisment on my site and after i preseed ok after editing i got this message 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 '' where ad_id=''' at line 1 then i checked to see if it had edited but it hadnt how do i fix this error? please help thanks
     
    crazycjcool1, Dec 17, 2008 IP
  2. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Post the full query.
     
    mwasif, Dec 18, 2008 IP
  3. crazycjcool1

    crazycjcool1 Peon

    Messages:
    159
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    sorry im a complete newbie to mysql u want me to post what?
     
    crazycjcool1, Dec 18, 2008 IP
  4. articledirectory

    articledirectory Peon

    Messages:
    1,704
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #4
    you need to post the query made to the database when you pushed the "ok" button.
     
    articledirectory, Dec 18, 2008 IP
  5. crazycjcool1

    crazycjcool1 Peon

    Messages:
    159
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    how i do find the query for that
     
    crazycjcool1, Dec 18, 2008 IP
  6. rajib.bahar

    rajib.bahar Active Member

    Messages:
    87
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    68
    #6
    go to that php or asp or aspx or html file and open it with notepad and search for:

    where ad_id=

    that will tell you what the query is... if you are still unsure what the full query is then copy and paste 5 lines before and after where ad_id=

    does this make sense?
     
    rajib.bahar, Dec 18, 2008 IP
  7. crazycjcool1

    crazycjcool1 Peon

    Messages:
    159
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    ok think i found it here //Todo parece correcto procedemos con la inserccion
    $query = "UPDATE ads SET active='1' WHERE ad_id='$id'";
    mysql_query($query) or die(mysql_error());
    mysql_query("UPDATE settings SET setvalue=setvalue+'1' WHERE setname='newadstoday'");
    mysql_query("UPDATE settings SET setvalue=setvalue+'1' WHERE setname='totalads'");

    echo "<font color=\"green\"><b>Advertise request has been approved.</b></font><br><br>";
    }

    if ($option=="deny"){

    $queryz = "DELETE FROM ads WHERE ad_id='$id'";
    mysql_query($queryz) or die(mysql_error());

    echo "<font color=\"#cc0000\"><b>Advertise request has been denied.</b></font><br><br>";
    }


    }
    ?> or is it this if ($_POST)
    {

    $id=$_POST["id"];
    $plan=$_POST["plan"];
    $url=$_POST["url"];
    $description=$_POST["description"];

    //Todo parece correcto procedemos con la inserccion
    $query = "UPDATE tb_ads SET ad_url='$url', ad_description='$description', clicksleft='{$_POST['clicksleft']}', premium='{$_POST['premium']} where ad_id='$id'";
    mysql_query($query) or die(mysql_error());

    echo "<font color=\"green\"><b>Advertisement successfully edited.</b></font><br><br>";
     
    crazycjcool1, Dec 19, 2008 IP
  8. amerigohosting

    amerigohosting Peon

    Messages:
    255
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    your problem is that $id is not defined, or not getting properly passed by the form you are using.
    what program are you using to manage your ads?
     
    amerigohosting, Dec 19, 2008 IP
  9. crazycjcool1

    crazycjcool1 Peon

    Messages:
    159
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    um its all done thro the script so im not sure
     
    crazycjcool1, Dec 19, 2008 IP
  10. amerigohosting

    amerigohosting Peon

    Messages:
    255
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    The form *in the html* will be passing variables that you can see via "view source".

    You can then grep for those values within the script. (the script takes the form values, and converts them into variables, ie $id)

    It could be a million things getting in the way...more than likely it is "just php being php" (I sort of really, really hate the language). And, more than likely, you are going to have to ask some help from the development team that produced the script. If they have jira/bugtracker on their site, I would highly recomend starting there.
     
    amerigohosting, Dec 19, 2008 IP
  11. skyper20

    skyper20 Active Member

    Messages:
    449
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #11
    I'm having the same problem. have you fixed the probs?
     
    skyper20, Jan 8, 2009 IP
  12. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #12
    It is better to start a new thread describing your problem.
     
    mwasif, Jan 8, 2009 IP
  13. skyper20

    skyper20 Active Member

    Messages:
    449
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #13
    i guess im facing the similar problem.
    this is the output:

    Edit Ads

    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 '' where ad_id=''' at line 1

    was thinking to start a new thread tho..
     
    skyper20, Jan 8, 2009 IP
  14. shadow arcade

    shadow arcade Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    hay for advertisment program you can also use the whole stoftware for that given by your HOST ;) that comes handy its just like google adsense
     
    shadow arcade, Jan 10, 2009 IP