[eluser]agammill[/eluser]
I'm a codeigniter beginner. I've been going over the tutorial of getting data and after various failed attempts, I've come here.
I currently use str_replace with an array but because the array is so large and is used over in various places, I wanted to put the elements in a table.
So this is what works: (I shortened the array since there are over 400 elements),
In Controller
Code:
$tag_input = str_replace(
array('text1','text2','text3'),
array('ő','ì','č'),
$tag_input
);
This is my latest failed attempt. I'm not getting errors but the str_replace isn't replacing.
Model
Code:
<?php
class Character_words_model extends MY_Model {
// vars
public $char_word;
public $word;
/**
* constructor
*/
function __construct() {
parent::__construct();
// initialize
$this->setTable('char_word_ref');
$this->setOrderBy('length', 'desc');
}
}
?>
In Controller:
Code:
function __construct() {
parent::__construct();
// make sure it's an ajax call
if (!IS_AJAX) {
die('this is not an ajax call');
}
$this->load->model('character_words_model');
}
$query = $this->db->query("SELECT * FROM 'char_word_ref'"); //I know I'm calling the query
//again but nothing else was working, including this.
$tag_input = str_replace(
foreach ($query->result() as $row) {$row->word;},
foreach ($query->result() as $row) {$row->char_word;},
$tag_input
);
What am I missing?
Thanks for any help you can give me.