hi guys i want to make some edit for my posting page and i tried to join 3 tables and get database from my edit posting page and i confused cause not the field from my table city this my problem photos and code
this my showing code
<select name="daerah_id" id="daerah_id" class="form-control">
<?php foreach ($daerah as $pf) : ?>
<?php if ($pf == $postfes['nm_daerah']) : ?>
<option value="<?= $pf; ?>" selected><?= $pf; ?></option>
<?php else : ?>
<option value="<?= $pf; ?>"><?= $pf; ?></option>
<?php endif; ?>
<?php endforeach; ?>
public function editPost($id)
{
$data['title'] = 'Edit Post';
$data['user'] = $this->db->get_where('user', ['email' => $this->session->userdata('email')])->row_array();
$this->load->model('PostModel', 'post');
$data['postfes'] = $this->post->getEditPost($id);
$data['daerah'] = $this->post->getEditPost($id);
if ($this->form_validation->run() == false) {
$this->load->view('templates/user-header', $data);
$this->load->view('templates/user-sidebar', $data);
$this->load->view('templates/user-topbar', $data);
$this->load->view('user/editPost', $data);
$this->load->view('templates/user-footer');
} else {
}
}
this my controller code
public function getEditPost($id)
{
$query = "SELECT * FROM `postfes`
JOIN `daerah` ON `postfes`.`daerah_id` = `daerah`.`id_daerah`
JOIN `user` ON `postfes`.`email_id` = `user`.`id`
WHERE `id_post` = '" . $id . "' AND `email_id` = '" . $_SESSION['id'] . "' ";
return $this->db->query($query)->row_array();
}
this my model code
how i can show my 34 field city in table daerah?
Aucun commentaire:
Enregistrer un commentaire