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

(11-29-2014, 05:10 PM)Rufnex Wrote: You have called the row() method wrong, try this:


PHP Code:
function test() {
 
 $test $this->db->query("SELECT name FROM users");
 
 $name $test->row()->name;s e
  return $name
;


I apologise, I thought it correct, I wrote wrong.
This example does not work:

function test() {
$test = $this->db->query("SELECT name FROM users");
$name = $test->row()->name;
return $name;
}

echo test();

The error is same:

Fatal error: Using $this when not in object context in /folder/with/my/project/admin.php on line 248
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 lkudlacek - 11-29-2014, 05:16 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 Rufnex - 12-01-2014, 03:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB