Loading ...
Sorry, an error occurred while loading the content.

281Re: [bang-phpug] Re: PEAR mdb2 error in php

Expand Messages
  • pritesh loke
    Dec 8, 2006
    • 0 Attachment
      If you have good tutorials for PEAR pls give me. :(
      Thank you.

      gayatri_ajith <gayatri_ajith@...> wrote: Hello,

      You are getting this error because your MDB2 object was not created.
      Instead, when you called the factory() function an error object was
      returned...as you will see in the error that you got is says
      "undefined method MDB2_Error::setFetchMode()...".
      This itself shows that it is trying to call the setFetchMode()
      function of the MDB2_Error object and not the MDB2 object, as it should.

      Please add this code at after the factory() function call
      if (MDB2::isError($mdb2)) {
      die($mdb2->getMessage().' - '.$mdb2->getUserinfo());
      This will tell you what the error occurred while creating the object.

      Hope this is helpful

      Best Regards

      --- In bang-phpug@yahoogroups.com, pritesh loke <priteshloke@...> wrote:
      > Hello to all
      > I want one littile help in PEAR
      > This is my code
      > <?
      > require_once "MDB2.php";
      > $dsn = "mysql://root:ppp@localhost/mht";
      > $options = array('persistent'=>true);
      > $mdb2 =& MDB2::factory($dsn,$options);
      > $mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC);
      > $sql = "select * from master";
      > $result = $mdb2->query($sql);
      > while($row=$result->fetchrow())
      > {
      > print $row['username']."<br />";
      > }
      > $result->free();
      > ?>
      > giving me error:
      > Fatal error: Call to undefined method MDB2_Error::setFetchMode() in
      D:\Program Files\xampp\htdocs\prrish\PEAR\dbdemo.php on line 6
      > Any body know the solution pls reply me.
      > Thank you.
      > ---------------------------------
      > Check out the all-new Yahoo! Mail beta - Fire up a more powerful
      email and get things done faster.
      > [Non-text portions of this message have been removed]

      Everyone is raving about the all-new Yahoo! Mail beta.

      [Non-text portions of this message have been removed]
    • Show all 3 messages in this topic