Thursday, 15 April 2010

php - Fatal error: Call to a member function first() on a non-object -


Yes, I know that there are so many questions about this topic I searched and tried all the answers but of them This is the reason why nobody has helped me, I have made another question with my code.

  class student {private $ _ db, $ _first; Public function __ composition () {$ this- & gt; _db = dB :: meet (); } Public function getLast ($ fields = array ()) {$ columns = 'admission_no, id'; $ OrderBy = 'id'; $ Order = 'DESC'; If (empty! ($ Field ['column'])) {$ columns = $ fields ['columns']; } If (empty! ($ Field ['order' by '])) {$ command by = $ field [' oder_b ']; } If (empty! ($ Field ['command'])) {$ command = $ field ['order']; } $ Data = $ this- & gt; _db-> Order {$ orderBy} {$ Order} LIMIT 1 ") by students from the query (" Select {$ column} "); if ($ data-> counts ()) {$ the- >-first = $ data- The first (); back true;} description is false;} Public celebrations first () {return $ this-> _first;}}  

is the code of the student class above And in the code below I am calling the student class, while calling the student class I get this error.

  $ student = new student; $ entry = $ student- & Gt; Match Last () -> First (); $ Admission_no = $ Q Sign-> login _no; resonance $ admission_no;  

Can you give me any clue or clue

"post-lesson" itemprop = "Text"> $ code = $ Student-> last match) -> First ();

This piece of code is completely You do not have the object to getLast () No $ Student object (the first method of the result) says GetLast () is correct or false.Try to try:

  $ Student-> getLast (); $ Sign = $ student- & gt; first ();  

No comments:

Post a Comment