无法从sql数据库中删除

I have designed a url loader for my site, it's 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 can't 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 fetch with curl and then delete, else skip loading url and delete it.

The url is fetched, but it isn't deleted at the end.

Most likely the query fails because $doma is a string that's not inside quotes, that is, your query is ... WHERE domain=foo when it should be ... WHERE domain='foo'.

mysql_query("DELETE FROM domain WHERE domain='".$doma."'") or die( mysql_error() );

(Remember the mysql_error() part, it'll help you debug a lot of issues later on.)

It is possible your query is missing single quotes around $doma ... try this instead ...

 "DELETE FROM domain WHERE domain='".$doma."'"

 mysql_query("DELETE FROM domain WHERE domain='".$doma."'"); // problem here

assuming $doma is a string ..