Tuesday 15 June 2010

php - Undefined property: CI_DB_mysql_result::$result -


I'm new to codeigniter programming. When I'm trying to connect to the database and retrieve data from the table, I got an error:

  There was a serious error of PHP error: Notice message: Undefined property: CI_DB_mysql_result :: $ Result filename: Model / Hi.PP line number: 15. A PHP error was encountered Seriousness: Warning message: Invalid argument provided for foreach () File name: views / getquery.php Line number: 2 < / Code>  

DataBy using Codeigniter For connecting I am using this code:

controller:
  & lt; Php class product CI_Controller expands {function __construct () {} function getall) {$ This-> Load-> Model ('hai'); $ Data ['query'] = $ this- & gt; Haii-> you (); $ This- & gt; Load-> View ('getquery', $ data); }}? & Gt;   

Model:
  & lt ;? Php class high catmodel expands {function __construct () {origin: __ generation (); $ This- & gt; Load-> Database (); } Function you () {$ query = $ this-> Db- & gt; Receive ('member'); Return $ query- & gt; result; }}? & Gt;   

See:
  & lt ;? Php foreach ($ query as $ line) {print $ row- & gt; User name; Print $ line-> password; Print $ line-> Fname; Print $ line-> Lname; Print $ line-> contact; Print "& lt; br & gt;"; }? & Gt;    

Use return $ query-> result (); instead of returns $ query-> result; In your you () function. Result is a method, not class members.

No comments:

Post a Comment