troubles with mdb2's numRows() function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Milan Krejci

    troubles with mdb2's numRows() function

    function odstran($jmeno) {
    $this->res=&$this->mdb2->query("DELET E FROM auth WHERE
    username='".$jm eno."' LIMIT 1");
    if (PEAR::isError( $this->res)) die($this->res->getMessage() );
    //var_dump($this->res);
    //echo $this->res->numRows();
    //if ($this->res->numRows()==1 ) echo ('<p>Uzivatel odstranen</p>');
    ////////////////////BUG ^^^
    }

    it should return 0 or 1 but it is NULL. the record has been deleted
    allright but numRows() doesn't return anything even if nothing has been
    deleted.
  • petersprc

    #2
    Re: troubles with mdb2's numRows() function

    Wonder what happens if you do:

    $db->loadModule('Ex tended');
    $count = $db->extended->execParam('del ete from auth where username = ?
    limit 1', array('.$|meno. '), null);

    echo "Delete $count records.";

    On Jul 26, 7:31 am, Milan Krejci <r...@mail.czwr ote:
    function odstran($jmeno) {
    $this->res=&$this->mdb2->query("DELET E FROM auth WHERE
    username='".$jm eno."' LIMIT 1");
    if (PEAR::isError( $this->res)) die($this->res->getMessage() );
    //var_dump($this->res);
    //echo $this->res->numRows();
    //if ($this->res->numRows()==1 ) echo ('<p>Uzivatel odstranen</p>');
    ////////////////////BUG ^^^
    }
    >
    it should return 0 or 1 but it is NULL. the record has been deleted
    allright but numRows() doesn't return anything even if nothing has been
    deleted.

    Comment

    • Milan Krejci

      #3
      Re: troubles with mdb2's numRows() function

      thanks mate! now it works, only
      array('.$|meno. ')
      should be array($jmeno)


      petersprc napsal(a):
      Wonder what happens if you do:
      >
      $db->loadModule('Ex tended');
      $count = $db->extended->execParam('del ete from auth where username = ?
      limit 1', array('.$|meno. '), null);
      >
      echo "Delete $count records.";
      >
      On Jul 26, 7:31 am, Milan Krejci <r...@mail.czwr ote:
      >function odstran($jmeno) {
      >$this->res=&$this->mdb2->query("DELET E FROM auth WHERE
      >username='".$j meno."' LIMIT 1");
      >if (PEAR::isError( $this->res)) die($this->res->getMessage() );
      >//var_dump($this->res);
      >//echo $this->res->numRows();
      >//if ($this->res->numRows()==1 ) echo ('<p>Uzivatel odstranen</p>');
      >////////////////////BUG ^^^
      > }
      >>
      >it should return 0 or 1 but it is NULL. the record has been deleted
      >allright but numRows() doesn't return anything even if nothing has been
      >deleted.
      >
      >

      Comment

      Working...