允许只插入一次表

时间:2015-08-10 01:27:56

标签: php mysql

我只能将“submitresume”插入我的表中一次。我正在尝试开发一个求职岗位功能,但出于某种原因,我的表只允许单个插入;即使我正在尝试申请另一个有不同job_id的职位。我在第一次插入后经常遇到数据库查询失败。

这是我的桌子。

submitted_id (auto increment) | individual_id | resume_id |submitted_status 
1                             |2              | 2         |1
2                             |3              | 3         |1

这是我的查询代码:

$sql = "INSERT INTO `submittedresume` 
        (`individual_id`, `resume_id`, `submitted_date`, 
         `submitted_status`, `job_post_id`, `application_desc`) "
     . "VALUES ('$Id','$resumeId','$uploadDate','1','$jobId',
                '$content')";

$results = $database->query($sql);
return $results;

1 个答案:

答案 0 :(得分:0)

  Please create database and then create table 
  --------------------------------------------
        #   Name                Type            Collation       Attributes  Null    Default         Extra   
        1   SrNo                double                                      No          None        AUTO_INCREMENT      
        2   submitted_date      date                                        No          None            
        3   resume_id           double                                      No          None            
        4   job_post_id         double                                      No          None            
        5   submitted_status    varchar(30)     latin1_swedish_ci           No          None            
        6   job_description     varchar(200)    latin1_swedish_ci           No          None        
  <?php
     mysql_query("INSERT INTO `tbl_submittedresume`(`SrNo`,`submitted_date`, `resume_id`, `job_post_id`, `submitted_status`, `job_description`)
        VALUES ('',$_POST['txtSubmittedDate'],$_POST['txtResumeId'],$_POST['txtJobPostId'],$_POST['txtSubmittedStatus'],$_POST['txtJobDescription'])");

       ?>