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
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?
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>";
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?
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.
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..
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