Welcome Guest, Not a member yet? Register   Sign In
Syntax in function does not work
#15

(This post was last modified: 12-01-2014, 02:25 PM by lkudlacek.)

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?
Reply


Messages In This Thread
Syntax in function does not work - by lkudlacek - 11-29-2014, 09:23 AM
RE: Syntax in function does not work - by Rufnex - 11-29-2014, 10:26 AM
RE: Syntax in function does not work - by Rufnex - 11-29-2014, 04:36 PM
RE: Syntax in function does not work - by Rufnex - 11-29-2014, 04:50 PM
RE: Syntax in function does not work - by Rufnex - 11-29-2014, 04:54 PM
RE: Syntax in function does not work - by Rufnex - 11-29-2014, 05:10 PM
RE: Syntax in function does not work - by Rufnex - 11-29-2014, 05:25 PM
RE: Syntax in function does not work - by Rufnex - 11-29-2014, 05:45 PM
RE: Syntax in function does not work - by lkudlacek - 12-01-2014, 02:22 PM
RE: Syntax in function does not work - by Rufnex - 12-01-2014, 03:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB