Nampilin data 2 table berdasarkan slug/url codeigniter

saya mau buat detail post dari 2 table... tabel 1 berisi title, description, img, dll tabel 2 berisi frame/embed video yang mau di tampilin di halaman detail

pemanggilan detail berdasarkan url udah bisa tapi di halaman detail gk muncul table frame/video embed yang tersimpan di table frame udah coba cara lain tetep gk bisa

Tabel frame

CREATE TABLE `frame` (
  `id_iframe` int(11) NOT NULL,
  `iframe_name` varchar(1000) NOT NULL,
  `title` varchar(1000) NOT NULL,
  `iframe` varchar(1000) NOT NULL,
  `url` varchar(1000) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `frame`
--

INSERT INTO `frame` (`id_iframe`, `iframe_name`, `title`, `iframe`, `url`) VALUES
(44, 'DailyMotion', 'Test', 'https://www.youtube.com/embed/vT3qfOFRuos', 'Test'),
(43, 'Youtube', 'Test', 'https://www.youtube.com/embed/GC2rCBJ11yw', 'Test'),
(45, 'Youtube', 'Test 2', 'https://www.youtube.com/embed/d3BXHo-C3fQ', 'Test_2'),
(46, 'Vidio.com', 'Test 2', 'https://www.youtube.com/embed/zyolpYTFrHk', 'Test_2');

Table title

--
-- Table structure for table `title`
--

CREATE TABLE `title` (
  `id_title` int(11) NOT NULL,
  `title` varchar(1000) NOT NULL,
  `url` varchar(1000) NOT NULL,
  `descrip` varchar(1000) NOT NULL,
  `img` varchar(1000) NOT NULL,
  `status` varchar(1000) NOT NULL,
  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `title`
--

INSERT INTO `title` (`id_title`, `title`, `url`, `descrip`, `img`, `status`, `date`) VALUES
(38, 'Test', 'Test', '', 'Vocaloid-hatsune-miku-sexy-anime-wallpapers-hd-desktop-and.jpg', 'Publish', '2019-10-14 09:40:12'),
(39, 'Test 2', 'Test_2', '', '199891.jpg', 'Publish', '2019-10-14 09:51:19');

Post_model.php

public function home() {
		$this->db->select('*');
		$this->db->from('title');
		// Join
		// $this->db->join('frame','frame.url = title.url');
		// End join
		$this->db->where('status','Publish');
		$this->db->order_by('id_title','DESC');
		// $this->db->limit(6);
		$query = $this->db->get();
		// $query = $this->db->get_where('title', array('status' => 'Publish' ));
		return $query->result();
	}

	//Read
	public function read($url) {
		$this->db->select('frame.*, title.title, title.url');
		$this->db->from('frame');
		// Join
		$this->db->join('title','title.title = frame.title');
		// End join
		$this->db->where('frame.url',$url);
		$this->db->order_by('frame.id_iframe','DESC');
		$query = $this->db->get();
		return $query->row();
	}

Controller/Post.php

public function read($url) {
		$con	= $this->Config_model->listing();
		$post	= $this->Post_model->home();
		$read	= $this->Post_model->read($url);

		$data	= array( 'con'		=> $con,
						 'title'	=> $read->title,
						 'keywords' => $read->title,
						 'post'		=> $post,
						 'read'		=> $read,
						 'isi'		=> 'post/p');
		$this->load->view('layout/wrapper',$data);

views/p.php

<div class="post-content">
	<!-- Start Stream Server -->
	<div id='multitab-video'>
		<div id="movie-player">
			<iframe src="srg.php" frameborder="0" webkitAllowFullScreen="" mozallowfullscreen="" allowFullScreen="" name="search_iframe"></iframe>
		</div>
		<div id="server-list">
			<div class="server-item" title="Stream Server">
				<?php foreach ($read as $p): ?>
					<a href="<?php echo $p->iframe ?>" target="search_iframe"><?php echo $p->iframe_name ?></a>
				<?php endforeach ?>
			</div>
		</div>
	</div>
</div>

tolong dibantu kak....

avatar okky123
@okky123

1 Kontribusi 0 Poin

Dipost 5 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban