Welcome Guest, Not a member yet? Register   Sign In
Syntax is echoing my base URL at the top of every URL link?
#1

[eluser]scm22ri[/eluser]
Hi Everyone,

For some reason my syntax is echoing out my base URL at the top of my page. I'm not sure why this is happening but I've been playing around with it for a few hours and can't seem to get it to work. It's prob. something silly but I can't pinpoint the error. Any help would be appreciated. Thanks

This is the URL the syntax below is echoing out
http://localhost/myfolder/under/states_cities

How can I correct this?

My Model
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Cars_under_data extends CI_Model{

function get_state(){
  $this->db->distinct();
     $this->db->select('state');
     $this->db->order_by('state','ASC');
  $this->db->where('approve','1');
     $query = $this->db->get('dealers');
     return $query->result();

  if ($query->num_rows() > 0){
    foreach($query->result() as $row){
    $data[] = $row;
    }
     return $data;
    }
    
}


}


My Controller

Code:
public function states(){
      $this->load->model('Cars_under_data');
      $data['results'] = $this->Cars_under_data->get_state();
      $this->load->view('view_states',$data);
   }

My View

Code:
<?php

foreach($results as $row){
$state = $row->state;
  
// echo anchor('under/states_cities/'.str_replace(' ','-',$row->state),$row->state, array('title'=>$row->state)).'<br>';
  echo anchor('under/states_cities/'.str_replace(' ','-',$row->state),$row->state).'<br>';
}

?&gt;
#2

[eluser]jairoh_[/eluser]
i don't see anything wrong in your codes. when u say about outputting the base_url, does it only outputs in that controller or in any other controllers or models or views too? because if does, then there are some part you're extending/requiring echoes it. you just need to find it. Smile




Theme © iAndrew 2016 - Forum software by © MyBB