Fatal error: Call to a member function fetchRow() on a non-object in C:\Xampp\xampp\htdocs...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello 

I am pleased if someone could explain me the behaviour since is wrong the following function call: ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC, $_SESSION["searchFormVars"]["offset"]+$rowCounter));
as you will find them below. By the way, fetchRow() is a method from class DB(.php). However mysql_fetch_row() should have same functionality but the argument resp. the identity is different. I hardly try to do not mix up functionality from mysql- with db- members. 

 
mysql_select_db("knowledge", $link);

$query = setupQuery($_SESSION["searchFormVars"]["search"]);     

$result=mysql_query($query);
        
     
 
   for ( $rowCounter = 0;
            ($rowCounter < SEARCH_ROWS) &&
            (( $rowCounter + $_SESSION["searchFormVars"]["offset"]) <  mysql_num_rows($result))  && 
               ($row = $result->fetchRow(DB_FETCHMODE_ASSOC, $_SESSION["searchFormVars"]["offset"]+$rowCounter));
           $rowCounter++)
      {   


Error message:
Fatal error: Call to a member function fetchRow() on a non-object in C:\Xampp\xampp\htdocs\www2\knowledge_db\searchnew.php on line ...

I am not shure that something should be wrong with the $result parameter since I have seen it in the PHP declaration and definition, see http://de.php.net/mysql_query below. I now that the return value of mysql_query is a boolean resp. a resource handler. In any case, I need the fetchRow functionality for correct work as listening to the rows on different pages. 




Another shorter possibility to print options of an ENUM as <select>-tag:
<?php
$result=mysql_query('SHOW COLUMNS FROM <your table> WHERE field=\'<you column>\'');
while ($row=mysql_fetch_row($result))
{
   foreach(explode("','",substr($row[1],6,-2)) as $v)
   {
     print("<option>$v</option>");
   }
}
?> 




best regards, Georg

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux