Related
I have created an employee registration form but I'm getting errors in image uploading and storing in the image folder and also getting errors in document file uploading. and errors like
Error Number: 1048
Column 'resume' cannot be null
INSERT INTO add_employee (photograph, name, date_of_birth, date_of_joining, designation, qualification, Blood_Group, exp_before_joining, exp_after_joining, total_exp, permanent_address, correspondance_address, resume, education_certificate, experience_certificate, id_proof, address_proof, contact, emergency_contact, emergency_contact_person) VALUES ('', 'xxx', '2021-04-10', '2021-04-10', 'Production', 'MCA', 'O+ve', '4', '4', '4', 'asdfgh \r\n ', ' hjghjfghdgfd,ghfchhf\r\n ', NULL, NULL, NULL, NULL, NULL, '6754321234', '6789557890', 'xzxz')
Filename: C:/xampp/htdocs/maheshfoundation/system/database/DB_driver.php
Line Number: 691
my view file
<?php echo form_open_multipart('employee/store');?>
<div class="row">
<div class="col-3">
<div class="form-group">
<label for="photograph">Photograph</label>
<input type="file" class="form-control" name="photograph" id="photograph" placeholder="Choose file" required>
<small><?php echo form_error('photograph'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="name">Enter Name</label>
<input type="text" class="form-control" name="name" id="name" placeholder="Enter Name" required>
<small><?php echo form_error('name'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="date_of_birth">Date of Birth</label>
<input type="date" class="form-control" name="date_of_birth" id="date_of_birth" placeholder="DOB" required>
<small><?php echo form_error('date_of_birth'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="date_of_joining">Date of Joining</label>
<input type="date" class="form-control" name="date_of_joining" id="date_of_joining" placeholder="DOJ" required>
<small><?php echo form_error('date_of_joining'); ?></small>
</div>
</div>
</div>
<div class="row">
<div class="col-3">
<div class="form-group">
<label for="designation">Designation</label>
<select class="form-control" name="designation" id="designation" required>
<option value="select">---Select---</option>
<option value="Marketing">Marketing</option>
<option value="Design">Design</option>
<option value="Super Admin">Super Admin</option>
<option value="Purchase">Purchase</option>
<option value="Planning">Planning</option>
<option value="Production">Production</option>
<option value="Quality">Quality</option>
<option value="Stores">Stores</option>
<option value="Management">Management</option>
<option value="HR">HR</option>
</select>
<small><?php echo form_error('designation'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="qualification">Qualification</label>
<input type="text" class="form-control" name="qualification" id="qualification" placeholder="Enter qualification" required>
<small><?php echo form_error('qualification'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="Blood Group">Blood Group</label>
<input type="text" class="form-control" name="Blood_Group" id="Blood_Group" placeholder="Enter Blood Group" required>
<small><?php echo form_error('Blood_Group'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="exp_before_joining">Experience Before Joining</label>
<input type="number" class="form-control" name="exp_before_joining" id="exp_before_joining" placeholder="Enter Experience Before Joining" required>
<small><?php echo form_error('exp_before_joining'); ?></small>
</div>
</div>
</div>
<div class="row">
<div class="col-3">
<div class="form-group">
<label for="exp_after_joining">Experience After Joining</label>
<input type="number" class="form-control" name="exp_after_joining" id="exp_after_joining" placeholder="Enter Experience After Joining" required>
<small><?php echo form_error('exp_after_joining'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="total_exp">Total Experience</label>
<input type="text" class="form-control" name="total_exp" id="total_exp" placeholder="Enter Total Experience" required>
<small><?php echo form_error('total_exp'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="Permanent_Address">Permanent Address *</label>
<textarea class="form-control" id="permanent_address" name="permanent_address" rows="4" cols="50" required>
</textarea>
<small><?php echo form_error('permanent_address'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="Correspondance_Address">Correspondance Address</label>
<textarea class="form-control" id="correspondance_address" name="correspondance_address" rows="4" cols="50" required>
</textarea>
<small><?php echo form_error('correspondance_address'); ?></small>
</div>
</div>
</div>
<div class="row">
<div class="col-3">
<div class="form-group">
<label for="resume">Resume</label>
<input type="file" class="form-control" name="resume" id="resume" placeholder="Choose file" required>
<small><?php echo form_error('resume'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="Education_Certificate">Education Certificate</label>
<input type="file" class="form-control" name="education_certificate" id="education_certificate" placeholder="Enter Name" required>
<small><?php echo form_error('education_certificate'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="Experience_Certificate">Experience Certificate</label>
<input type="file" class="form-control" name="experience_certificate" id="experience_certificate" placeholder="DOB" required>
<small><?php echo form_error('experience_certificate'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="id_proof">ID Proof *</label>
<input type="file" class="form-control" name="id_proof" id="id_proof" placeholder="DOJ" required>
<small><?php echo form_error('id_proof'); ?></small>
</div>
</div>
</div>
<div class="row">
<div class="col-3">
<div class="form-group">
<label for="Address_Proof">Address Proof</label>
<input type="file" class="form-control" name="address_proof" id="address_proof" placeholder="Choose file" required>
<small><?php echo form_error('address_proof'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="contact">Permanent Contact Number *</label>
<input type="text" class="form-control" name="contact" id="contact" placeholder="Enter Permanent Contact Number" required>
<small><?php echo form_error('contact'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="emergency_contact">Emergency Contact Number</label>
<input type="text" class="form-control" name="emergency_contact" id="emergency_contact" placeholder="Enter Emergency Contact Number" required>
<small><?php echo form_error('emergency_contact'); ?></small>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label for="emergency_contact_person">Emergency Contact Person Name ?</label>
<input type="text" class="form-control" name="emergency_contact_person" id="emergency_contact_person" placeholder="Enter Emergency Contact Person Name" required>
<small><?php echo form_error('emergency_contact_person'); ?></small>
</div>
</div>
</div>
<button type="submit" value="submit" class="btn btn-primary">Submit</button>
<button type="reset" value="reset" class="btn btn-primary">Reset</button>
my controller file
public function store()
{
$photograph = $this->input->POST('photograph');
$name = $this->input->POST('name');
$date_of_birth = $this->input->POST('date_of_birth');
$date_of_joining = $this->input->POST('date_of_joining');
$designation = $this->input->POST('designation');
$qualification = $this->input->POST('qualification');
$Blood_Group = $this->input->POST('Blood_Group');
$exp_before_joining = $this->input->POST('exp_before_joining');
$exp_after_joining = $this->input->POST('exp_after_joining');
$total_exp = $this->input->POST('total_exp');
$permanent_address = $this->input->POST('permanent_address');
$correspondance_address = $this->input->POST('correspondance_address');
$resume = $this->input->POST('resume');
$education_certificate = $this->input->POST('education_certificate');
$experience_certificate = $this->input->POST('experience_certificate');
$id_proof = $this->input->POST('id_proof');
$address_proof = $this->input->POST('address_proof');
$contact = $this->input->POST('contact');
$emergency_contact = $this->input->POST('emergency_contact');
$emergency_contact_person = $this->input->POST('emergency_contact_person');
$configUpload['upload_path'] = 'images/'; #the folder placed in the root of project
$configUpload['allowed_types'] = 'gif|jpg|png|bmp|jpeg'; #allowed types description
$configUpload['max_size'] = '0'; #max size
$configUpload['max_width'] = '0'; #max width
$configUpload['max_height'] = '0'; #max height
$configUpload['encrypt_name'] = TRUE; #encrypt name of the uploaded file
$this->load->library('upload', $configUpload); #init the upload class
if (!$this->upload->do_upload())
{
$uploadedDetails = $this->upload->display_errors();
}
else
{
$uploadedDetails = $this->upload->data();
}
$emp_filename = $this->upload->data('file_name');
//print_r($uploadedDetails);
// // die;
echo "<br><br>";
$data = array(
'photograph' => $emp_filename,
'name' => $name,
'date_of_birth' => $date_of_birth,
'date_of_joining' => $date_of_joining,
'designation' => $designation,
'qualification' => $qualification,
'Blood_Group' => $Blood_Group,
'exp_before_joining' => $exp_before_joining,
'exp_after_joining' => $exp_after_joining,
'total_exp' => $total_exp,
'permanent_address' => $permanent_address,
'correspondance_address' => $correspondance_address,
'resume' => $resume,
'education_certificate' => $education_certificate,
'experience_certificate' => $experience_certificate,
'id_proof' => $id_proof,
'address_proof' => $address_proof,
'contact' => $contact,
'emergency_contact' => $emergency_contact,
'emergency_contact_person' => $emergency_contact_person
);
$this->load->model('EmployeeModel','emp');
$this->emp->insertEmployee($data);
redirect(base_url('add'));
}
my model file
public function insertEmployee($data)
{
return $this->db->insert('add_employee', $data);
}
I have a problem with my php-code. On the first site is a list with all the data. The table of the data is correctly displayed. In the last column of the table is a link placed to the next page which should hand over the id of the row.
Here's the link:
print 'Ändern';
But I can't now get the data into the input fields for edit. The form show up correct, but i have in every input field this error:
Warning: Illegal string offset 'vorname' in /home_pr5/d/e/deniseli.ch/htdocs/www.deniseli.ch/T .... tor/editsr.php on line 130S
Here's the editsr.php:
<?php
session_start();
require_once("inc/config.inc.php");
require_once("inc/functions.inc.php");
$id = $_GET['id'];
$statement = $pdo->prepare("SELECT * FROM users WHERE id = $id");
$result = $statement->execute(array('id' => ['id']));
$user = $statement->fetch();
include("templates/header.inc.php");
if(isset($_GET['save'])) {
$save = $_GET['save'];
if($save == 'personal_data') {
$vorname = trim($_POST['vorname']);
$nachname = trim($_POST['nachname']);
$adresse = trim($_POST['adresse']);
$plz = trim($_POST['plz']);
$ort = trim($_POST['ort']);
$geburtstag = trim($_POST['geburtstag']);
$handy = trim($_POST['handy']);
$liga = trim($_POST['liga']);
$verein = trim($_POST['verein']);
$bank = trim($_POST['bank']);
$iban = trim($_POST['iban']);
if($vorname == "" || $nachname == "" || $adresse == "" || $plz == "" || $ort == "" || $handy == "" || $liga == "" || $verein == "") {
$error_msg = "Bitte alle Angaben ausfüllen.";
} else {
$statement = $pdo->prepare("UPDATE users SET vorname = :vorname, nachname = :nachname, adresse = :adresse, plz = :plz, ort = :ort, geburtstag = :geburtstag, handy = :handy, liga = :liga, verein = :verein, bank = :bank, iban = :iban, id = :id, updated_at=NOW() WHERE id = $id");
$result = $statement->execute(array('vorname' => $vorname, 'nachname'=> $nachname,'adresse' => $adresse, 'plz' => $plz, 'ort' => $ort, 'geburtstag' => $geburtstag, 'handy' => $handy, 'liga' => $liga, 'verein' => $verein,'bank' => $bank, 'iban' => $iban, 'id' => $user['id'] ));
$success_msg = "Daten erfolgreich gespeichert.";
}
} else if($save == 'email') {
$passwort = $_POST['passwort'];
$email = trim($_POST['email']);
$email2 = trim($_POST['email2']);
if($email != $email2) {
$error_msg = "Die eingegebenen E-Mail-Adressen stimmten nicht überein.";
} else if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error_msg = "Bitte eine gültige E-Mail-Adresse eingeben.";
} else if(!password_verify($passwort, $user['passwort'])) {
$error_msg = "Bitte korrektes Passwort eingeben.";
} else {
$statement = $pdo->prepare("UPDATE users SET email = :email WHERE id = $id");
$result = $statement->execute(array('email' => $email));
$success_msg = "E-Mail-Adresse erfolgreich gespeichert.";
}
} else if($save == 'passwort') {
$passwortAlt = $_POST['passwortAlt'];
$passwortNeu = trim($_POST['passwortNeu']);
$passwortNeu2 = trim($_POST['passwortNeu2']);
if($passwortNeu != $passwortNeu2) {
$error_msg = "Die eingegebenen Passwörter stimmten nicht überein.";
} else if($passwortNeu == "") {
$error_msg = "Das Passwort darf nicht leer sein.";
} else if(!password_verify($passwortAlt, $user['passwort'])) {
$error_msg = "Bitte korrektes Passwort eingeben.";
} else {
$passwort_hash = password_hash($passwortNeu, PASSWORD_DEFAULT);
$statement = $pdo->prepare("UPDATE users SET passwort = :passwort WHERE id = $id");
$result = $statement->execute(array('passwort' => $passwort_hash));
$success_msg = "Passwort erfolgreich gespeichert.";
}
}
}
?>
<div class="container main-container">
<h1>Schiedsrichter Profil bearbeiten</h1>
<?php
if(isset($success_msg) && !empty($success_msg)):
?>
<div class="alert alert-success">
×
<?php echo $success_msg; ?>
</div>
<?php
endif;
?>
<?php
if(isset($error_msg) && !empty($error_msg)):
?>
<div class="alert alert-danger">
×
<?php echo $error_msg; ?>
</div>
<?php
endif;
?>
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">Übersicht</li>
<li role="presentation">Persönliche Daten</li>
<li role="presentation">E-Mail</li>
<li role="presentation">Passwort</li>
</ul>
<!-- Übersicht-->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">
<br>
<form action="?save=personal_data&id=<?php echo $_GET['id'] ?>" method="post" class="form-horizontal">
<div class="form-group">
<label for=inputVorname class="col-sm-2 control-label">Vorname</label>
<div class="col-sm-10">
<input class="form-control" id="inputVorname" name="vorname" type="text" value="<?php echo htmlentities($user['vorname']); ?>" readonly>
</div>
</div>
<div class="form-group">
<label for="inputNachname" class="col-sm-2 control-label">Nachname</label>
<div class="col-sm-10">
<input class="form-control" id="inputNachname" name="nachname" type="text" value="<?php echo htmlentities($user['nachname']); ?>" readonly>
</div>
</div>
<div class="form-group">
<label for="inputAdresse" class="col-sm-2 control-label">Adresse</label>
<div class="col-sm-10">
<input class="form-control" id="inputAdresse" name="adresse" type="text" value="<?php echo htmlentities($user['adresse']); ?>" readonly>
</div>
</div>
<div class="form-group">
<label for="inputPLZ" class="col-sm-2 control-label">PLZ</label>
<div class="col-sm-10">
<input class="form-control" id="inputPLZ" name="plz" type="text" value="<?php echo htmlentities($user['plz']); ?>" readonly>
</div>
</div>
<div class="form-group">
<label for="inputOrt" class="col-sm-2 control-label">Ort</label>
<div class="col-sm-10">
<input class="form-control" id="inputOrt" name="ort" type="text" value="<?php echo htmlentities($user['ort']); ?>" readonly>
</div>
</div>
<div class="form-group">
<label for="inputGeburtstag" class="col-sm-2 control-label">Geburtsdatum</label>
<div class="col-sm-10">
<input class="form-control" id="inputGeburtstag" name="geburtstag" type="text" value="<?php echo htmlentities($user['geburtstag']); ?>" readonly>
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-sm-2 control-label">E-Mail</label>
<div class="col-sm-10">
<input class="form-control" id="inputEmail" name="email" type="email" value="<?php echo htmlentities($user['email']); ?>" readonly>
</div>
</div>
<div class="form-group">
<label for="inputHandy" class="col-sm-2 control-label">Handy</label>
<div class="col-sm-10">
<input class="form-control" id="inputHandy" name="handy" type="text" value="<?php echo htmlentities($user['handy']); ?>" readonly>
</div>
</div>
<div class="form-group">
<label for="inputLiga" class="col-sm-2 control-label">Liga</label>
<div class="col-sm-10">
<input class="form-control" id="inputLiga" name="liga" type="text" value="<?php echo htmlentities($user['liga']); ?>" readonly>
</div>
</div>
<div class="form-group">
<label for="inputVerein" class="col-sm-2 control-label">Verein</label>
<div class="col-sm-10">
<input class="form-control" id="inputVerein" name="verein" type="text" value="<?php echo htmlentities($user['verein']); ?>" readonly>
</div>
</div>
<div class="form-group">
<label for="inputBank" class="col-sm-2 control-label">Bankname</label>
<div class="col-sm-10">
<input class="form-control" id="inputBank" name="bank" type="text" value="<?php echo htmlentities($user['bank']); ?>" readonly>
</div>
</div>
<div class="form-group">
<label for="inputIban" class="col-sm-2 control-label">IBAN</label>
<div class="col-sm-10">
<input class="form-control" id="inputIban" name="iban" type="text" value="<?php echo htmlentities($user['iban']); ?>" readonly>
</div>
</div>
</form>
</div>
<!-- Persönliche Daten-->
<div role="tabpanel" class="tab-pane" id="data">
<br>
<form action="?save=personal_data&id=<?php echo $_GET['id'] ?>" method="post" class="form-horizontal">
<div class="form-group">
<label for="inputVorname" class="col-sm-2 control-label">Vorname</label>
<div class="col-sm-10">
<input class="form-control" id="inputVorname" name="vorname" type="text" value="<?php echo htmlentities($user['vorname']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputNachname" class="col-sm-2 control-label">Nachname</label>
<div class="col-sm-10">
<input class="form-control" id="inputNachname" name="nachname" type="text" value="<?php echo htmlentities($user['nachname']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputAdresse" class="col-sm-2 control-label">Adresse</label>
<div class="col-sm-10">
<input class="form-control" id="inputAdresse" name="adresse" type="text" value="<?php echo htmlentities($user['adresse']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputPLZ" class="col-sm-2 control-label">PLZ</label>
<div class="col-sm-10">
<input class="form-control" id="inputPLZ" name="plz" type="text" value="<?php echo htmlentities($user['plz']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputOrt" class="col-sm-2 control-label">Ort</label>
<div class="col-sm-10">
<input class="form-control" id="inputOrt" name="ort" type="text" value="<?php echo htmlentities($user['ort']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputGeburtstag" class="col-sm-2 control-label">Geburtsdatum</label>
<div class="col-sm-10">
<input class="form-control" id="inputGeburtstag" name="geburtstag" type="text" value="<?php echo htmlentities($user['geburtstag']); ?>" placeholder="01.01.2000">
</div>
</div>
<div class="form-group">
<label for="inputHandy" class="col-sm-2 control-label">Handy</label>
<div class="col-sm-10">
<input class="form-control" id="inputHandy" name="handy" type="text" value="<?php echo htmlentities($user['handy']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputLiga" class="col-sm-2 control-label">Liga</label>
<div class="col-sm-10">
<input class="form-control" id="inputLiga" name="liga" type="text" value="<?php echo htmlentities($user['liga']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputVerein" class="col-sm-2 control-label">Verein</label>
<div class="col-sm-10">
<input class="form-control" id="inputVerein" name="verein" type="text" value="<?php echo htmlentities($user['verein']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputBank" class="col-sm-2 control-label">Bankname</label>
<div class="col-sm-10">
<input class="form-control" id="inputBank" name="bank" type="text" value="<?php echo htmlentities($user['bank']); ?>" placeholder="Postfinance">
</div>
</div>
<div class="form-group">
<label for="inputIban" class="col-sm-2 control-label">IBAN</label>
<div class="col-sm-10">
<input class="form-control" id="inputIban" name="iban" type="text" value="<?php echo htmlentities($user['iban']); ?>" placeholder="CHxx xxxx xxxx xxxx xxxx x">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary">Speichern</button>
<a class="btn btn-danger" href='internal.php'>Abbrechen</a>
</div>
</div>
</form>
</div>
<!-- Änderung der E-Mail-Adresse -->
<div role="tabpanel" class="tab-pane" id="email">
<br>
<p>Zum Änderen deiner E-Mail-Adresse gib bitte dein aktuelles Passwort sowie die neue E-Mail-Adresse ein.</p>
<form action="?save=email&id=<?php echo $_GET['id'] ?>" method="post" class="form-horizontal">
<div class="form-group">
<label for="inputPasswort" class="col-sm-2 control-label">Passwort</label>
<div class="col-sm-10">
<input class="form-control" id="inputPasswort" name="passwort" type="password" required>
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-sm-2 control-label">E-Mail</label>
<div class="col-sm-10">
<input class="form-control" id="inputEmail" name="email" type="email" value="<?php echo htmlentities($user['email']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputEmail2" class="col-sm-2 control-label">E-Mail (wiederholen)</label>
<div class="col-sm-10">
<input class="form-control" id="inputEmail2" name="email2" type="email" required>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary">Speichern</button>
<a class="btn btn-danger" href='spielliste.php'>Abbrechen</a>
</div>
</div>
</form>
</div>
<!-- Änderung des Passworts -->
<div role="tabpanel" class="tab-pane" id="passwort">
<br>
<p>Zum Änderen deines Passworts gib bitte dein aktuelles Passwort sowie das neue Passwort ein.</p>
<form action="?save=passwort&id=<?php echo $_GET['id'] ?>" method="post" class="form-horizontal">
<div class="form-group">
<label for="inputPasswort" class="col-sm-2 control-label">Altes Passwort</label>
<div class="col-sm-10">
<input class="form-control" id="inputPasswort" name="passwortAlt" type="password" required>
</div>
</div>
<div class="form-group">
<label for="inputPasswortNeu" class="col-sm-2 control-label">Neues Passwort</label>
<div class="col-sm-10">
<input class="form-control" id="inputPasswortNeu" name="passwortNeu" type="password" required>
</div>
</div>
<div class="form-group">
<label for="inputPasswortNeu2" class="col-sm-2 control-label">Neues Passwort (wiederholen)</label>
<div class="col-sm-10">
<input class="form-control" id="inputPasswortNeu2" name="passwortNeu2" type="password" required>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary">Speichern</button>
<a class="btn btn-danger" href='spielliste.php'>Abbrechen</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<?php
include("templates/footer.inc.php")
?>
UPDATE: new code editsr.php. Works fine with the tabs, only the changes displayed after refresh the site.
Look at your code carefully
on the top you are using the $user variable like below
$id = $_GET['id'];
$statement = $pdo->prepare("SELECT * FROM users WHERE id = :id");
$result = $statement->execute(array('id' => ['id']));
$user = $statement->fetch(); // here
and again on the bottom of php code you are using $user variable like below
$id = $_GET['id'];
$user = "SELECT * FROM users WHERE id = :id"; // here
?>
on the input you are trying to get like htmlentities($user['vorname']);
<div class="form-group">
<label for=inputVorname class="col-sm-2 control-label">Vorname</label>
<div class="col-sm-10">
<input class="form-control" id="inputVorname" name="vorname" type="text" value="<?php echo htmlentities($user['vorname']); ?>" readonly>
</div>
</div>
that's the problem of error in every input :)
New Code with only one form:
<?php
session_start();
require_once("inc/config.inc.php");
require_once("inc/functions.inc.php");
$id = $_GET['id'];
$statement = $pdo->prepare("SELECT * FROM users WHERE id = $id");
$result = $statement->execute(array('id' => ['id']));
$user = $statement->fetch();
include("templates/header.inc.php");
if(isset($_GET['save'])) {
$save = $_GET['save'];
if($save == 'personal_data') {
$vorname = trim($_POST['vorname']);
$nachname = trim($_POST['nachname']);
$adresse = trim($_POST['adresse']);
$plz = trim($_POST['plz']);
$ort = trim($_POST['ort']);
$geburtstag = trim($_POST['geburtstag']);
$handy = trim($_POST['handy']);
$email = trim($_POST['email']);
$liga = trim($_POST['liga']);
$verein = trim($_POST['verein']);
$bank = trim($_POST['bank']);
$iban = trim($_POST['iban']);
$passwortNeu = trim($_POST['passwortNeu']);
if($vorname == "" || $nachname == "" || $adresse == "" || $plz == "" || $ort == "" || $handy == "" || $liga == "" || $verein == "" || $email == "" || $passwortNeu == "" ){
$error_msg = "Bitte alle Angaben ausfüllen.";
} else {
$passwort_hash = password_hash($passwortNeu, PASSWORD_DEFAULT);
$statement = $pdo->prepare("UPDATE users SET vorname = :vorname, nachname = :nachname, adresse = :adresse, plz = :plz, ort = :ort, geburtstag = :geburtstag, handy = :handy, liga = :liga, verein = :verein, bank = :bank, iban = :iban, passwort = :passwort, email = :email, updated_at=NOW() WHERE id = $id");
$result = $statement->execute(array('vorname' => $vorname, 'nachname'=> $nachname,'adresse' => $adresse, 'plz' => $plz, 'ort' => $ort, 'geburtstag' => $geburtstag, 'handy' => $handy, 'liga' => $liga, 'verein' => $verein,'bank' => $bank, 'iban' => $iban, 'passwort' => $passwort_hash, 'email' => $email));
$success_msg = "Daten erfolgreich gespeichert.";
}
}
}
?>
<div class="container main-container">
<h1>Schiedsrichter Profil bearbeiten</h1>
<?php
if(isset($success_msg) && !empty($success_msg)):
?>
<div class="alert alert-success">
×
<?php echo $success_msg; ?>
</div>
<?php
endif;
?>
<?php
if(isset($error_msg) && !empty($error_msg)):
?>
<div class="alert alert-danger">
×
<?php echo $error_msg; ?>
</div>
<?php
endif;
?>
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">Persönliche Daten</li>
</ul>
<!-- Persönliche Daten-->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="data">
<br>
<form action="?save=personal_data" method="post" class="form-horizontal">
<div class="form-group">
<label for="inputVorname" class="col-sm-2 control-label">Vorname</label>
<div class="col-sm-10">
<input class="form-control" id="inputVorname" name="vorname" type="text" value="<?php echo htmlentities($user['vorname']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputNachname" class="col-sm-2 control-label">Nachname</label>
<div class="col-sm-10">
<input class="form-control" id="inputNachname" name="nachname" type="text" value="<?php echo htmlentities($user['nachname']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputAdresse" class="col-sm-2 control-label">Adresse</label>
<div class="col-sm-10">
<input class="form-control" id="inputAdresse" name="adresse" type="text" value="<?php echo htmlentities($user['adresse']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputPLZ" class="col-sm-2 control-label">PLZ</label>
<div class="col-sm-10">
<input class="form-control" id="inputPLZ" name="plz" type="text" value="<?php echo htmlentities($user['plz']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputOrt" class="col-sm-2 control-label">Ort</label>
<div class="col-sm-10">
<input class="form-control" id="inputOrt" name="ort" type="text" value="<?php echo htmlentities($user['ort']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputGeburtstag" class="col-sm-2 control-label">Geburtsdatum</label>
<div class="col-sm-10">
<input class="form-control" id="inputGeburtstag" name="geburtstag" type="text" value="<?php echo htmlentities($user['geburtstag']); ?>" placeholder="01.01.2000">
</div>
</div>
<div class="form-group">
<label for="inputHandy" class="col-sm-2 control-label">Handy</label>
<div class="col-sm-10">
<input class="form-control" id="inputHandy" name="handy" type="text" value="<?php echo htmlentities($user['handy']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-sm-2 control-label">E-Mail</label>
<div class="col-sm-10">
<input class="form-control" id="inputEmail" name="email" type="email" value="<?php echo htmlentities($user['email']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputLiga" class="col-sm-2 control-label">Liga</label>
<div class="col-sm-10">
<input class="form-control" id="inputLiga" name="liga" type="text" value="<?php echo htmlentities($user['liga']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputVerein" class="col-sm-2 control-label">Verein</label>
<div class="col-sm-10">
<input class="form-control" id="inputVerein" name="verein" type="text" value="<?php echo htmlentities($user['verein']); ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputBank" class="col-sm-2 control-label">Bankname</label>
<div class="col-sm-10">
<input class="form-control" id="inputBank" name="bank" type="text" value="<?php echo htmlentities($user['bank']); ?>" placeholder="Postfinance">
</div>
</div>
<div class="form-group">
<label for="inputIban" class="col-sm-2 control-label">IBAN</label>
<div class="col-sm-10">
<input class="form-control" id="inputIban" name="iban" type="text" value="<?php echo htmlentities($user['iban']); ?>" placeholder="CHxx xxxx xxxx xxxx xxxx x">
</div>
</div>
<div class="form-group">
<label for="inputPasswortNeu" class="col-sm-2 control-label">Neues Passwort</label>
<div class="col-sm-10">
<input class="form-control" id="inputPasswortNeu" name="passwortNeu" type="password" value="<?php echo htmlentities($user['passwort']); ?>" required>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary">Speichern</button>
<a class="btn btn-danger" href='internal.php'>Abbrechen</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<?php
include("templates/footer.inc.php")
?>
i think i have correctly writting this code but i get a problem on missing argument and i selected file image to upload but i get error too like this.
A PHP Error was encountered
Severity: Warning
Message: Missing argument 1 for Data_guru::edit()
Filename: tim_monitoring/Data_guru.php
Line Number: 90
Backtrace:
File: C:\xampp\htdocs\sdb\application\controllers\tim_monitoring\Data_guru.php
Line: 90
Function: _error_handler
File: C:\xampp\htdocs\sdb\index.php
Line: 315
Function: require_once
You did not select a file to upload.
thanks for your answer
My Controller
public function edit($id) {
$this->form_validation->set_rules('nama_guru','Nama Guru','required');
$this->form_validation->set_rules('alamat','Alamat','required');
if ($this->form_validation->run() === FALSE) {
$data = array ('title' => 'Edit Data Guru',
'detail' => $this->monitoring_model->detail_guru($id),
'isi' => 'monitoring/edit_guru_view'
);
$this->load->view('monitoring/layout/wrapper',$data);
//Kalau Tidak Ada Error Data Guru DiUpdate
}else{
$config['file_name'] = $this->input->post('nama_guru');
$config['upload_path'] = './assets/image/guru/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 3000;
$config['max_width'] = 3000;
$config['max_height'] = 3000;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('foto_guru'))
{
echo $this->upload->display_errors();
}
else
{
$gbr = $this->upload->data();
$data = array(
'foto_guru' => $gbr['file_name'],
'id_guru' => $this->input->post('id_guru'),
'nama_guru' => $this->input->post('nama_guru'),
'jenis_kelamin' => $this->input->post('jen_kel'),
'alamat' => $this->input->post('alamat'),
'tempat_lahir' => $this->input->post('tempat_lahir'),
'tgl_lahir' => $this->input->post('tgl_lahir'),
'no_hp' => $this->input->post('no_hp'),
'username' => $this->input->post('username'),
'password' => $this->input->post('password')
);
$this->monitoring_model->edit_guru($data);
redirect(base_url().'tim_monitoring/data_guru');
}
}
}
My Model
//Menampilkan Detail Guru Di Halaman Edit Guru
public function detail_guru($id) {
$query = $this->db->get_where('t_guru', array('id_guru' => $id));
return $query->row_array();
}
//Update Data Guru Setelah Di Edit Di Halaman Edt
public function edit_guru($data) {
$this->db->where('id_guru',$data['id_guru']);
return $this->db->update('t_guru',$data);
}
My View
<form action="<?php echo base_url() ?>/tim_monitoring/data_guru/edit" class="form-horizontal" method="post">
<div class="form-group">
<label for="inputEmail3" class="col-sm-4 control-label">Nama Guru</label>
<div class="col-sm-6">
<input type="text" name="nama_guru" class="form-control" placeholder="Nama Guru" value="<?php echo $detail['nama_guru'] ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-4 control-label">Tempat Lahir</label>
<div class="col-sm-6">
<input type="text" name="tempat_lahir" class="form-control" placeholder="Tempat Lahir" value="<?php echo $detail['tempat_lahir'] ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-4 control-label">Tanggal Lahir</label>
<div class="col-sm-6">
<input type="date" name="tgl_lahir" class="form-control" value="<?php echo $detail['tgl_lahir'] ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-4 control-label">Alamat</label>
<div class="col-sm-6">
<textarea name="alamat" class="form-control" rows="4" required><?php echo $detail['alamat'] ?></textarea>
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-4 control-label">No Handphone</label>
<div class="col-sm-6">
<input type="number" name="no_hp" class="form-control" placeholder="No Handphone" value="<?php echo $detail['no_hp'] ?>" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Foto</label>
<div class="col-sm-6">
<input type="file" name="foto_guru" id="exampleInputFile" required>
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-4 control-label">Username</label>
<div class="col-sm-6">
<input type="text" name="username" class="form-control" placeholder="Username" value="<?php echo $detail['username'] ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-4 control-label">Password</label>
<div class="col-sm-6">
<input type="password" name="password" class="form-control" placeholder="Password" value="<?php echo $detail['password'] ?>" required>
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-4 control-label">Jenis Kelamin</label>
<div class="col-sm-6">
<input type="radio" name="jen_kel" value="L"><label> Laki - Laki</label>
<input type="radio" name="jen_kel" value="P"><label> Perempuan</label>
</div>
</div>
<input type="hidden" name="id_guru" class="form-control" value="<?php echo $detail['id_guru'] ?>" required>
<div class="form-group">
<div class="col-sm-4">
</div>
<div class="col-sm-6">
<button type="submit" class="btn btn-primary">Ubah Data</button>
</div>
</div>
</form>
Please see edit() Method of tim_monitoring/Data_guru.php that's must be require to pass one parameter as value of variable $id.
So, you need to add following URL in form's action
action="<?php echo base_url() ?>/tim_monitoring/data_guru/edit/<?php echo $detail['id_guru'] ?>"
For upload image form must require attribute enctype="multipart/form-data"
I have a two table to be inserted, I want to insert two times in every in each table. But in my code the only first amount will be inserted. Can you give me an advice on what should i do because I'm not really good in CI.
Here is my controller
function addloads(){
$data = array(
'member' => $this->input->post('member'),
'cell_number' => $this->input->post('cell_number'),
'amount' => $this->parseAmount($this->input->post('amount')),
'total' => $this->parseAmount($this->input->post('total')),
'status' => $this->input->post('status'),
'added_by' => $this->session->userdata('admin_id'),
'date' => date('Y-m-d',strtotime($this->input->post('date'))),
'after_rebate' => $this->input->post('rebate'),
);
$this->db->where('mem_id',$this->input->post('member'));
$this->db->insert('loading_service',$data);
$status = $this->input->post('status');
if($status == 'paid'){
$data2 = array(
'incomefrom_id' => $this->input->post('member'),
'income_name' => 'Load',
'date_created' => date('Y-m-d',strtotime($this->input->post('date'))),
);
$this->db->set('time_created', 'NOW()', FALSE);
$this->db->insert('incomefrom',$data2);
$amount = $this->parseAmount($this->input->post('amount'));
$total = $this->parseAmount($this->input->post('total'));
$all = $total - $amount;
$data3 = array(
'amount' => $all,
'incomefrom' => $this->input->post('member'),
'trans_date' => date('Y-m-d',strtotime($this->input->post('date'))),
);
$this->db->set('trans_time', 'NOW()', FALSE);
$this->db->insert('income',$data3);
$amount = $this->parseAmount($this->input->post('amount'));
$after = $this->parseAmount($this->input->post('rebate'));
$income = $amount - $after;
$data9 = array(
'amount' => $income,
'incomefrom' => $this->input->post('member'),
'trans_date' => date('Y-m-d',strtotime($this->input->post('date'))),
);
$this->db->set('trans_time', 'NOW()', FALSE);
$this->db->insert('income',$data9);
$data10 = array(
'incomefrom_id' => $this->input->post('member'),
'income_name' => 'Rebate',
'date_created' => date('Y-m-d',strtotime($this->input->post('date'))),
);
$this->db->set('time_created', 'NOW()', FALSE);
$this->db->insert('incomefrom',$data10);
}
//$this->load->view('loadingservice',$data);
//redirect(base_url('loadscontroller/loadingserviceview'));
}
And this is my view
<form action="<?php echo base_url('loadscontroller/addloads') ?>" method="post">
<div class="row">
<div class="col-xs-6">
<div class="form-group" id="member_form">
<label for="member">Member</label>
<?php
$sql=mysql_query("SELECT * FROM member WHERE mem_is_deleted='0' ORDER BY mem_fname ASC ");
if(mysql_num_rows($sql)){
$select= '<select class="form-control" id="member" name="member" required >';
while($rs=mysql_fetch_array($sql)){
$select.='<option value="'.$rs['mem_id'].'">'.$rs['mem_fname'].' ' .$rs['mem_lname'].'</option>';
}
}
$select.='</select>';
echo $select;
?>
<p class="help-block text-danger" id="member_err"></p>
</div>
<div class="form-group" id="cell_number">
<label for="cell_number">Cellphone Number</label>
<input type="text" class="form-control" id="cell_number" name="cell_number" placeholder="" required>
<!-- <p class="help-block text-danger" id="grossamount_err"></p> -->
</div>
<div class="form-group">
<label for="amount">Amount</label>
<input type="text" id="txt1" onkeyup="sum();" value="5" hidden>
<input type="text" class="form-control " id="amount" name="amount" placeholder="00" required onkeyup="sum();">
</div>
</div>
</div>
<!-- <div class="row" id="willsend" style="display:none">
<div class="col-xs-6">
<div class="form-group">
<p>Will send <span id="lblnet"></span> to <span id="lblbaccountname"></span> <span id="lblbaccount"></span></p>
</div>
</div>
</div> -->
<div class="row">
<div class="col-xs-3">
<div class="form-group">
<label for="total">Total</label>
<input type="text" class="form-control" id="total" name="total" placeholder="00" required >
</div>
</div>
</div>
<div class="row">
<div class="col-xs-3">
<div class="form-group">
<!-- <label for="total">With Rebate</label> -->
<input type="text" id="rebate" name="rebate" >
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group" style="width: 200px;">
<label for="date">Date</label>
<input type="text" class="form-control readonly datepicker" id="date" name="date" value="<?php echo date('F d, Y') ?>" required readonly>
</div>
</div>
</div>
<div class="form-group" id="status">
<label for="status">Status</label>
<select class="form-control" id="status" name="status" required style="width: 150px;">
<option selected="" value="">--select--</option>
<option value="paid">PAID</option>
<option value="unpaid">UNPAID</option>
</select>
</div>
<button type="submit" class="btn btn-default">Submit</button>
<!-- /.row -->
</form>
This question already has answers here:
PHP PDOException: "SQLSTATE[HY093]: Invalid parameter number"
(4 answers)
Closed 6 years ago.
Hi I have a problem I have a record where 4 tables and each of them relates to their use of the lastInsertId to take the last inserted id generated but nevertheless I get this little problem.
THIS IS MY CODE CLASS:
public function regnuevo($ruc,$pwd,$rsocial,$ncomercial,$direfiscal,$telefono,$web,$rucs,$direfac,$nombre,$paterno,$materno,$cargo,$celular,$email){
try{
$insertar = $this->bd->prepare("INSERT INTO empresa (ruc,pwd,razonsocial,nombrecomercial,direccionfiscal,departamento,distrito,provincia,estado) values (:ruc,:pwd,:rsocial,:ncomercial,:direfiscal,15,1249,129,1)");
$insertar->bindparam(":ruc",$ruc);
$insertar->bindparam(":pwd",$pwd);
$insertar->bindparam(":rsocial",$rsocial);
$insertar->bindparam(":ncomercial",$ncomercial);
$insertar->bindparam(":direfiscal",$direfiscal);
$insertar->execute();
$ultimoid = $this->bd->lastInsertId();
$insertar = $this->bd->prepare("INSERT INTO empresa_detalle (telefono1,web,ruc,id_empresa) values(:telefonos,:web,:ruc,:id_emp)");
$insertar->bindparam(":telefonos",$telefono);
$insertar->bindparam(":web",$web);
$insertar->bindparam(":ruc",$rucs);
$insertar->bindparam(":id_emp",$ultimoid);
$insertar->execute();
$insertar = $this->bd->prepare("INSERT INTO datosfacturacion (direccion,id_empresa) values(:dire,:id_empf)");
$insertar->bindparam(":dire",$direfac);
$insertar->bindparam(":id_empf",$ultimoid);
$insertar->execute();
$insertar1 = $this->bd->prepare("INSERT INTO socios(nombre,apaterno,amaterno,cargo,grado,tipodocumento,genero,celular,correooficina,estado,id_empresa) values(:nombre,:apaterno,:amaterno,:cargo,1,1,1,:telefono,:email,'1',:id_empresa)");
$insertar1->execute(array(":nombre" => $nombre,
"apaterno"=>$paterno,
":materno"=>$materno,
":cargo"=>$cargo,
":celular"=>$celular,
":id_empresa"=>$ultimoid,
":email"=>$email));
return true;
}
catch(PDOException $e) {
echo $e->getMessage();
return false;
}
THIS IS A FORM :
<div class="container">
<form action="reg_nuevo.php" class="form-horizontal" method="post">
<div class="form-group">
<p class="txticon"><span class="glyphicon glyphicon-plus-sign iconos"></span> Registro de Nuevo Socio</p>
*Solo se puede registrar 3 socios por empresa en caso de tener 4 socios comuniquese con el área de Sistemas
</div>
<div class="form-group">
<label for="" class="control-label col-md-2">R.U.C</label>
<div class="col-md-3">
<input type="text" class="form-control" name="ruc">
</div>
<label for="" class="control-label col-md-2">Razón Social</label>
<div class="col-md-3">
<input type="text" class="form-control" name="raz">
</div>
</div>
<div class="form-group">
<label for="" class="control-label col-md-2">Nombre Comercial</label>
<div class="col-md-3">
<input type="text" class="form-control" name="comercial">
</div>
<label for="" class="control-label col-md-2">Dirección Fiscal</label>
<div class="col-md-3">
<input type="text" class="form-control" name="direccion">
</div>
</div>
<div class="form-group">
<label for="" class="control-label col-md-2">Telefono</label>
<div class="col-md-3">
<input type="text" class="form-control" name="telefono">
</div>
<label for="" class="control-label col-md-2">Dirección de entrega de Factura</label>
<div class="col-md-3">
<input type="text" class="form-control" name="facturacion">
</div>
</div>
<div class="form-group">
<label for="" class="control-label col-md-2">Web</label>
<div class="col-md-3">
<input type="text" class="form-control" name="web">
</div>
</div>
<div class="form-group col-md-12">
<div class="form-group child col-md-12">
<p class="txticon"><span class="glyphicon glyphicon-user iconos"></span>Registro de Socio</p>
<div class="form-group">
<label for="" class="control-label col-md-1">Nombre</label>
<div class="col-md-2">
<input type="text" class="form-control" name="socio">
</div>
<label for="" class="control-label col-md-1">A.Paterno</label>
<div class="col-md-2">
<input type="text" class="form-control" name="paterno">
</div>
<label for="" class="control-label col-md-1">A.Materno</label>
<div class="col-md-2">
<input type="text" class="form-control" name="materno">
</div>
</div>
<div class="form-group">
<label for="" class="control-label col-md-1">Cargo</label>
<div class="col-md-2">
<input type="text" class="form-control" name="cargo">
</div>
<label for="" class="control-label col-md-1">Email</label>
<div class="col-md-2">
<input type="email" class="form-control" name="email">
</div>
<label for="" class="control-label col-md-1">Telefono</label>
<div class="col-md-2">
<input type="text" class="form-control" name="celular">
</div>
</div>
<!--<input class="btn btn-danger deleteButton cerrar" type="button" value="Eliminar" />-->
</div>
</div>
<!--<input class="btn btn-success cerrar" type="button" id="create_button" value="Agregar Socio" />-->
<input class="btn btn-lg btn-info" type="submit" value="Registrar" name="enviar">
</form>
The last insert are wrong, are missing two named placedholeders, :celular( maybe could be :telefono), :materno (:amaterno) does not exists
$insertar1 = $this->bd->prepare("INSERT INTO socios(nombre,apaterno,amaterno,cargo,grado,tipodocumento,genero,celular,correooficina,estado,id_empresa)
values(:nombre,:apaterno,:amaterno,:cargo,1,1,1,:telefono,:email,'1',:id_empresa)");
$insertar1->execute(array(":nombre" => $nombre,
"apaterno"=>$paterno,
":materno"=>$materno,
":cargo"=>$cargo,
":celular"=>$celular,
":id_empresa"=>$ultimoid,
":email"=>$email));
To fix just match names of array keys with place holders:
$insertar1->execute(array(":nombre" => $nombre,
"apaterno"=>$paterno,
":amaterno"=>$materno,
":cargo"=>$cargo,
":telefono"=>$celular,
":id_empresa"=>$ultimoid,
":email"=>$email));
You're mixing parameters up: :celular should be :telefono. And :materno should be :amaterno in your $insertar1 query.
Looks like you need to fix "apaterno"=>$paterno, by adding a : to :apaterno
Like so: ":apaterno"=>$paterno, (Re: Is the leading colon for parameter names passed to PDOStatement::bindParam() optional?)
Full code becomes:
$insertar1 = $this->bd->prepare(
"INSERT INTO socios(
nombre,
apaterno,
amaterno,
cargo,
grado,
tipodocumento,
genero,
celular,
correooficina,
estado,
id_empresa
) values (
:nombre,
:apaterno,
:amaterno,
:cargo,
1,
1,
1,
:telefono,
:email,
'1',
:id_empresa
)"
);
$insertar1->execute(array(":nombre" => $nombre,
":apaterno"=>$paterno,
":amaterno"=>$materno,
":cargo"=>$cargo,
":telefono"=>$celular,
":email"=>$email,
":id_empresa"=>$ultimoid
));