I apologise, I am beginner with CodeIgniter.
Your example works...but I must define a controller.
I try it clarify again.
1) Download current version CodeIgniter
2) Define your application/config/database.php
3) Define application/config/autoload
Change
$autoload['libraries'] = array();
..to..
$autoload['libraries'] = array('database');
4) Edit application/views/welcome_message.php and put the lines:
$this->load->database();
function test_codeigniter_syntax() {
$test = $this->db->query("YOUR SIMPLY QUERY");
echo $test->row()->yourColumn;
}
//Call function
test_codeigniter_syntax(); // IT DOES NOT WORK ME
Step 4 again and correct:
Edit application/views/welcome_message.php and put the lines:
$this->load->database();
function test_standard_syntax() {
$test = mysql_query("YOUR SIMPLY QUERY");
$test = mysql_result($test, "0", "yourColumn");
}
//Call function
test_standard_syntax(); // IT WORKS ME
My question is - why? I want to use CodeIgniter syntax.
Or.....Does it use function() in CodeIgniter else anyhow? For example over controller/model?