SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot asmictech's Avatar
    Join Date
    Oct 2004
    Location
    nigeria
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question DISPLAY NUMBER OF AFFECTED ROWS(odbc_?)

    Dear folks,
    pls help me out.
    i have written a code to change password. it works perfectly i.e. sql query "update is ok", now i want to display number of affected rows that i can inform user if password is changed or not. here is my code pls help out.
    i could find which property to use.
    using php to connect to ms access(dsn connection).



    here is my code

    <?php

    Class changepin {
    function changepin($oldpwd,$newpwd,$cnewpwd){
    $this->oldpwd=$oldpwd;
    $this->newpwd=$newpwd;
    $this->cnewpwd=$cnewpwd;

    //echo "submitted values:".$uid,$pwd;
    if(isset($oldpwd)&&isset($newpwd)&&isset($cnewpwd)){
    require_once "conn.php";
    session_start();
    $uid=$_SESSION['uid'];
    $query="update biodata set pwd='$newpwd' where uid='$uid'";
    if(!odbc_exec($connect,$query)){echo "Error executing query:".$query;}
    else{$result=odbc_exec($connect,$query);}
    $row_num=odbc_fetch_row($result);
    echo $row_num;
    if($row_num==0){
    echo "Failed";}
    else{session_start();
    $_SESSION['uid']=$uid;
    echo "Successful"; }//end inner if statement
    odbc_close($connect);
    }//close of outer if
    }//close method
    }//close class

    if((isset($_POST['oldpwd'])&&isset($_POST['newpwd'])&&isset($_POST['cnewpwd']))&&($_POST['newpwd']=$_POST['cnewpwd'])){
    $oldpwd=$_POST['oldpwd'];
    $newpwd=$_POST['newpwd'];
    $cnewpwd=$_POST['cnewpwd'];

    new changepin($oldpwd,$newpwd,$cnewpwd);
    }// close of if statement
    else{
    header("location: changepin.php");
    }
    ?>

    expecting ur reply soonest.
    Success is achieved and maintained by those who keep trying.

    www.ngportal.net

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cross-post. Please don't cross-post. See http://www.sitepoint.com/forums/showthread.php?t=225092


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •