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

PEAR mdb2 error in php

Expand Messages
  • pritesh loke
    Hello to all I want one littile help in PEAR This is my code
    Message 1 of 3 , Nov 28, 2006
    • 0 Attachment
      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]
    • gayatri_ajith
      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
      Message 2 of 3 , Dec 7, 2006
      • 0 Attachment
        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]
        >
      • pritesh loke
        Hello If you have good tutorials for PEAR pls give me. :( Thank you. gayatri_ajith wrote: Hello,
        Message 3 of 3 , Dec 8, 2006
        • 0 Attachment
          Hello
          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]
        Your message has been successfully submitted and would be delivered to recipients shortly.