2010-04-19 5 views
2
while($row=mysql_fetch_array($result2)){  
     //return $row['ProjectID']; 
     $sql="INSERT INTO `tycodashboard` (ProjectID,DesignationID,ReqcompID,IntOrgID,FinishedTimeID,ProjectStatusID,PhaseID 
       ) VALUES('{$row['ProjectID']}','$pm,'$req','$initiating,'$initiating','$ftime,'$ProjectStatus,'$Phase)"; 
     $result=mysql_query($sql); 
     if(!$result){ 
      if(mysql_errno() == ER_DUP_ENTRY){ 
       throw new Exception("INSERT FAILED.\n\nThe database already contains a Project with the Project Name \"$ldesc\", please pick another."); 
      }else{ 
       throw new Exception("INSERT FAILED.\n\n".mysql_error()); 
      } 
     } 
     }//exits 

    INSERT FAILED. 

    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 '3','2,'2','2,'2,'3)' at line 2 

Répondre

7

Il vous manque un tas de citations comme vous pouvez le voir dans le message d'erreur:

'3','2,'2','2,'2,'3 

Essayez d'ajouter les citations où ils sont portés disparus et voir si cela aide:

$sql="INSERT INTO `tycodashboard` (ProjectID,DesignationID,ReqcompID,IntOrgID,FinishedTimeID,ProjectStatusID,PhaseID 
    ) VALUES ('{$row['ProjectID']}','$pm','$req','$initiating','$initiating','$ftime','$ProjectStatus','$Phase')"; 
Questions connexes