CodeIgniter Forums
$this->dblink - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: $this->dblink (/showthread.php?tid=13166)



$this->dblink - El Forum - 11-13-2008

[eluser]phpserver[/eluser]
I came across this line of code in someones controller file code and i tried it.

function save()
{
$item['id']=$this->input->post("id");
$item['job']=$this->input->post("job");
$this->dblink->put_item($item);
}

put_item is the model file.I tried running the code and the error was 'Undefined property:Toby::$dblink

My controller file is toby.php


$this->dblink - El Forum - 11-15-2008

[eluser]tobyberesford[/eluser]
I'm not sure where the code you are getting this from is! But anyway

dblink is the name of the model - see models/dblink.php

It probably fails because the model hasn't been loaded earlier:

eg. $this->load->model("dblink");

Cheers

Toby


$this->dblink - El Forum - 11-16-2008

[eluser]phpserver[/eluser]
[quote author="tobyberesford" date="1226793769"]I'm not sure where the code you are getting this from is! But anyway

dblink is the name of the model - see models/dblink.php

It probably fails because the model hasn't been loaded earlier:

eg. $this->load->model("dblink");

Cheers

Toby[/quote]

Hi Toby,visit http://www.phplondon.org/conference/2008/media/docs/toby_beresford_ci_overview.pdf


$this->dblink - El Forum - 11-17-2008

[eluser]tobyberesford[/eluser]
Ah thanks. I've now checked and have deleted all the original code for the demo I'm afraid.

Cheers

Toby