Welcome Guest, Not a member yet? Register   Sign In
code is not working properly
#1

[eluser]Unknown[/eluser]
Quote:
this is my controller.php
<?php
class search extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->helper('url');

}
public function index()
{

$this->load->model('Model_form');
$this->load->helper('form');

$data['countries'] = $this->Model_form->get_countries();
$data['bodies'] = $this->Model_form->get_bodies();
$data['query']=$this->Model_form->trksearch();
$this->Model_form->display();
$data['query1']=$this->Model_form->display();
$data['query2']=$this->Model_form->display();
$data['query']=$this->Model_form->display();

$data['base_url']=base_url();
$this->load->view('trksearch',$data);

} ?>

this iz my model.php
<?php
class Model_form extends CI_Model
{
function __construct()
{
// Call the Model constructor
parent::__construct();
$this->load->database();
}
public function display()
{
$make = $this->input->post('mkno');
$model = $this->input->post('modno');

$this->db->select('mkcmpny');
$this->db->where('mkno',$make);
$query1=$this->db->get('mktruck');
return $query1->result();

$model = $this->input->post('modno');
$this->db->select('modnm');
$this->db->where('modno',$model);
$query2=$this->db->get('mkmodel');
return $query2->result();


$this->db->select('id,km,rgat,bdty,eprc,desr');
$this->db->where('mk',$make);
$this->db->where('md',$model);
$query=$this->db->get('tbl_sel');
return $query->result();

}
} ?>

this is my view.php
<div id="trucksearch">
&lt;?php
foreach($query1 as $rows)
{
$truck=$rows->mkcmpny;
}
foreach ($query2 as $rows)
{ $model=$rows->modnm;}
foreach ($query as $rows)
{
$id=$rows->id;
$km =$rows->km;
$rgat=$rows->rgat;
$bdty=$rows->bdty;
$eprc=$rows->eprc;
$descr=$rows->desr;


?&gt;
<br/>
<table width="720" border="2" bordercolor="#999999" align="center">
<tr><td valign="Left" width="200" bgcolor="#E8E8E8" class="table_text1"><p align="left">
<strong>Make And Model :</strong></p></td>
<td valign="Left" width="520" bgcolor="#E8E8E8" class="table_text1"><p align="left">a href="viewsaletrk.php?msg=&lt;?php echo $id; ?&gt;">&lt;?php echo $make;?&gt;&nbsp;&nbsp;&lt;?php echo $model ;?&gt;</a></p></td><tr/>
<tr><td valign="bottom" width="200" bgcolor="#E8E8E8" class="table_text1"><p align="left">strong>KM Run:</strong></td>
<td valign="Left" width="520" bgcolor="#E8E8E8" class="table_text1"><p align="left">&lt;?php echo $km ;?&gt;</p></td></tr>
<tr><td valign="bottom" width="200" bgcolor="#E8E8E8" class="table_text1"><p align="left">strong>Body Type:</strong></td>
<td valign="Left" width="520" bgcolor="#E8E8E8" class="table_text1"><p align="left">p align="left" style="color:#0d4c7d">&lt;?php echo $bdty;?&gt;</p></td></tr>
<tr><td valign="bottom" width="200" bgcolor="#E8E8E8" class="table_text1"><p align="left">strong>City:</strong></td>
<td valign="Left" width="520" bgcolor="#E8E8E8" class="table_text1"><p align="left">p align="left" style="color:#0d4c7d">&lt;?php echo $rgat;?&gt;</p></td></tr>
<tr><td valign="bottom" width="200" bgcolor="#E8E8E8" class="table_text1"><p align="left">strong>Expected Price:</strong></td>
<td valign="Left" width="520" bgcolor="#E8E8E8" class="table_text1"><p align="left">p align="left" style="color:#0d4c7d">&lt;?php echo $eprc;?&gt;</p></td></tr>

<tr><td valign="bottom" width="200" bgcolor="#E8E8E8" class="table_text1"><p align="left">strong>Description:</strong></td>
<td valign="bottom" width="520" bgcolor="#E8E8E8" height="25" class="table_text1"><p align="left">&lt;?php echo $descr;?&gt;</p></td></tr>
<tr ><td><p align="left">&nbsp;</p></td></tr>
&lt;?php

}
?&gt;
&lt;!--</tr> --&gt;

</table>
</div>


Messages In This Thread
code is not working properly - by El Forum - 08-22-2012, 09:05 PM
code is not working properly - by El Forum - 08-23-2012, 02:47 PM
code is not working properly - by El Forum - 08-23-2012, 03:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB