TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Swapnil Phadke
NA
1
1k
how to fetch images from database
Aug 11 2014 2:59 AM
I m beginner in codeignitor.my problem is when i fetch data from database all other data has fetched but image are not displayed.please proveide me code for how to fetch image from database.
model file code
<?php
class Car_model extends CI_Model
{
function getAllRecords()
{
$this->load->database();
$q = $this->db->get('cardetails');
if($q->num_rows() > 0)
{
return $q->result();
}
return array();
}
}
?>
controller file code
<?php
class Search extends CI_Controller {
function searchname()
{
$this->load->model("car_model");
$data['records'] = $this->car_model->getAllRecords();
$this->load->view('header_view');
$this->load->view('search',$data);
$this->load->view('footer_view');
}
}
?>
view file code
<?php
foreach($records as $row):
?>
<tr>
<td><img height="100" width="200" src="http://localhost/ci_user/images.'<?php=$row->mco_carimage?>.'
"/></td>
<td align="center"><?=$row->mco_carname ?></td>
<td align="center"><?=$row->mco_totalkm ?></td>
<td align="center"><?=$row->mco_price ?> Rs</td>
<td align="center"><?=$row->mco_insurance ?></td>
<td align="center"><?=$row->mco_fualtype ?></td>
</tr>
<?php
endforeach;
?>
Reply
Answers (
1
)
How to insert the data using jQuery ajax in php
launch/run the .Exe file upon the webpage