hello i have desinged url loader for my site , its working fine but have little problem that it cant delete url at end after loading <?php // set time 1000 set_time_limit(1000); // connect to db include ("../../config.php"); // select data from database target domain and T2 table $result = mysql_query( "SELECT * FROM domain" ) or die("SELECT Error: ".mysql_error()); $resultx = mysql_query( "SELECT * FROM worth" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_query($result); $num_rowsx = mysql_query($resultx); // fetching data while ($get_infox = mysql_fetch_assoc($resultx) && $get_info = mysql_fetch_assoc($result)) { $domax="www.".$get_infox[domain]; $doma=$get_info[domain]; if ($doma != $domax[domain]) { // load urls $url="http://www.w3db.org/".$doma.""; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 15); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $index=curl_exec($ch); $error=curl_error($ch); curl_close($ch); // deleting current loaded url echo "url loaded and deleted ".$url."<br />"; mysql_query("DELETE FROM domain WHERE domain=".$doma.""); // problem here } else { echo "url skiped and deleted ".$url."<br />"; mysql_query("DELETE FROM domain WHERE domain=".$doma.""); // problem here } } mysql_close($con); ?> i do not know why it cant delete code is ok no error i do not know why please help for test Table 1 :: domain having column domain Table 2 :: T1 having column domain task :: take url from (table 1) domain compare with (Table 2) domain url if not match loaded with curl and then delete else skip loading url and delete it. it load url but it end cant delete ??? help
Try just using some of those queries directly in MySQL. If you have phpMyAdmin installed (which you do if you are on a CPanel server) then just go in and run those queries manually. It will tell you in at least some detail what errors it finds or why it won't work.
When it ends up running the query, it's missing some quotes: DELETE FROM domain WHERE domain=foo Code (markup): What you want it to be is: DELETE FROM domain WHERE domain="foo"; Code (markup): So change your code to: mysql_query("DELETE FROM domain WHERE domain=\"".$doma."\""); Code (markup): Also, I hope $doma has been sanitized if it contains user input. Otherwise you're writing code vulnerable to SQL injection.
ya thanks i already fixed it as dgmdan said that quotes are missed so few days ago i fixed i forget quotes around $doma just an idiot
It is preferrable to use single quotes : ' rather than double since double quotes may at times depend on certain MySql settings