I have problem in inserting multiple records in a table using cursors. The php code that Iam using is below.
What I want to acheive is as follows;
1. I want this code to select records from one table or table view then insert each record in another table.
2. records will be have same one foreign key, then diffrent primary keys.

Now my problem is that the code below is inserting one same record many times, instead of inserting many diffrerent records. So what is the best way of handling this???
Your help will appreciated


PHP Code:
<?php
             
include ('conn.php');
             
$ic=$row_xd['Id'];
              
$icode=$row_xd['AllowanceId'];
              
$coclaimed=$row_xd['ClaimCode'];
              
$coamount=$row_xd['MyDiff'];
              
              
              if(
$coamount>0){
          for (
$ic 1$ic <= 10$ic++)  {
            if ((
$icode !='') && ($coclaimed != '') && ( $coamount != ''))
{
$mysql_query="INSERT INTO payments (TravelNumber,TotalAmount,Description)".
 
"VALUES ('$icode','$coamount','$coclaimed')" ;
mysql_query($mysql_query) or die('9Error, insert query failed'); 

}
              
         
//$mysql_query ="UPDATE payments  SET Transactioncode ='t88',TotalAmount='12356789',TransactionType='PP', Description=' $coclaimed'  where TravelNumber='$icode' and ApplicationDate='2006-07-23'";
 //mysql_query($mysql_query) or die('Error, update query failed'); 

              
              
             
           
  
               // }
              
echo"positive";
              }
              }
              elseif(
$coamount<0)
              {
              echo
"negative";
              }
              else
              {
              echo
"equal";
              }
         
              
              
?>