Here I am copying data of table to another table .whenever I use hardcode for id value then it will work and other sccenario it is not working
<p>In this Php query I am copying data from one table to another table.
In first table column names are Worker_Type,No_of_Worker,Date_From,Date_To and another table's columns are Worker_Type,No_of_Worker,Date_From,Date_To,id .</p>

<pre><code>&lt;?php
$host='localhost';
$uname='';
$pwd='';
$db="client_supplier";

$con = mysql_connect($host,$uname,$pwd) or die("connection failed");
mysql_select_db($db,$con) or die("db selection failed");

$id=$_REQUEST['id'];
$Worker_Type=$_REQUEST['Worker_Type'];
$No_of_Worker=$_REQUEST['No_of_Worker'];
$Date_From=$_REQUEST['Date_From'];
$Date_To=$_REQUEST['Date_To'];


$flag['code']=0;

if($r=mysql_query("INSERT INTO Interested(Worker_Type,No_of_Worker,Date_From,Date_To) SELECT Worker_Type,No_of_Worker,Date_From,Date_To FROM Supplier_data WHERE id ='$id' ",$con))
{
    $flag['code']=1;
    echo"hi";
}

print(json_encode($flag));
mysql_close($con);
?&gt;
</code></pre>