Question

I have just used the simple query to insert record

$q = "INSERT INTO jobform
            (`full_name`,
             `father_name`,
             `date_of_birth`,
             `gender`,
             `cnic`,
             `city`,
             `country`,
             `region`,
             `contact_number`,
             `email_address`,
             `degree_title`,
             `university`,
             `gpa`,
             `division`,
             `banking_experience`,
             `current_organization`,
             `job_title`,
             `non_banking_experience`,
             `non_current_organization`,
             `non_job_title`)
VALUES (:full_name,
        :father_name,
        :date_of_birth,
        :gender,
        :cnic,
        :city,
        :country,
        :region,
        :contact_number,
        :email_address,
        :degree_title,
        :university,
        :gpa,
        :division,
        :banking_experience,
        :current_organization,
        :job_title,
        :non_banking_experience,
        :non_current_organization,
        :non_job_title)";

  $bind = array(
  ":full_name"=>$full_name,
  ":father_name"=>$father_name,
  ":date_of_birth"=>$date_of_birth,
  ":gender"=>$gender,
  ":cnic"=>$cnic,
  ":city"=>$city,
  ":country"=>$country,
  ":region"=>$region,
  ":contact_number"=>$contact_number,
  ":email_address"=>$email_address,
  ":degree_title"=>$degree_title,
  ":university"=>$university,
  ":gpa"=>$gpa,
  ":division"=>$division,
  ":banking_experience"=>$banking_experience,
  ":current_organization"=>$current_organization,
  ":job_title"=>$job_title,
  ":non_banking_experience"=>$non_banking_experience,
  ":non_current_organization"=>$non_current_organization,
  ":non_job_title"=>$non_job_title
  );

$r = $database->query($q,$bind);

and getting this error, there is no documentation for inserting rows too

Fatal error: Uncaught exception 'Eden_Sql_Error' with message 'INSERT INTO jobform (`full_name`, `father_name`, `date_of_birth`, `gender`, `cnic`, `city`, `country`, `region`, `contact_number`, `email_address`, `degree_title`, `university`, `gpa`, `division`, `banking_experience`, `current_organization`, `job_title`, `non_banking_experience`, `non_current_organization`, `non_job_title`) VALUES ('najm', 'zain', '01-01-2000', 'male', '923092032094209', 'karachi', 'Pakistan', 'sindh', '029320329', 'najm@najm.com', 'Bachelor', 'College Of digital science', '16', 'First', '3 Year', 'BAS', 'Account Manager', '2 Year', in /save.php on line 115
Was it helpful?

Solution

You should use $database->insertRow instead.

Try this.

$data = array(
            'full_name' => $full_name,
             'date_of_birth' => $date_of_birth  ,
             'gender' => $gender  ,
             'cnic' => $cnic  ,
             'city' => $city  ,
             'country' => $country  ,
             'region' => $region  ,
             'contact_number' => $contact_number  ,
             'email_address' => $email_address  ,
             'degree_title' => $degree_title  ,
             'university' => $university  ,
             'gpa' => $gpa  ,
             'division' => $division  ,
             'banking_experience' => $banking_experience  ,
             'current_organization' => $current_organization  ,
             'job_title' => $job_title  ,
             'non_banking_experience' => $non_banking_experience  ,
             'non_current_organization' => $non_current_organization  ,
             'non_job_title' => $non_job_title
    );

    $result = $database->insertRow('jobform', $data);

Please see official documentation

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top