Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2009
    Posts
    5

    Unanswered: Update from form on db2

    Hello guys..
    well, I want to update my table from a form.
    <?
    $dbname="database";
    $dbuser="user";
    $dbpasswd="pass";
    $conn = db2_pconnect($dbname,$dbuser,$dbpasswd);

    $sql = "UPDATE Customers SET cust_id='$customerID2', firstnme='$First2', lastname='$Last2' where cust_id='$customerID2'";
    $result=db2_exec($conn,$sql);
    if($result){
    echo "Row Updated."."\n";
    }
    else {
    echo "Row not updated."."\n";
    echo db2_stmt_errormsg();

    but nothing happen..

    FYI, I can connect to database, insert, select and delete data.

    Regard.
    Last edited by jazzjansen; 11-11-09 at 10:25.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    have you checked the error message to see if there is an error on the update
    using MySQL its something like:
    PHP Code:
    $result=db2_exec($conn,$sql);
    if (
    mySQL_ERROR>0)
    //insert error handling here
    } else
    //do something

    but you will need to see what error handling is available under DB2
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Oct 2009
    Posts
    5
    Quote Originally Posted by healdem View Post
    have you checked the mysql_error/mysql_errorno to find out if there is an error on the update
    PHP Code:
    $result=db2_exec($conn,$sql);
    if (
    mySQL_ERROR>0)
    //insert error handling here
    } else
    //do something

    thanks before.. Well, I deal with DB2. not mysql.. or maybe I don't get what do you mean.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    yeah sorry about that
    mis read your post expecting you to be using MySQL, edited it when I realised you were using DB2.

    I'd suggest you check the PHP help system to find out how you examine how errors are reported when using DB2
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Oct 2009
    Posts
    5
    Quote Originally Posted by healdem View Post
    yeah sorry about that
    mis read your post expecting you to be using MySQL, edited it when I realised you were using DB2.

    I'd suggest you check the PHP help system to find out how you examine how errors are reported when using DB2
    hehe..
    but when I run the page which action calls those scripts, I get blank page. I wish I get some notification about error.. But nothing,
    if($result){
    echo "Row Updated."."\n";
    }
    else {
    echo "No Row updated."."\n";

    I dont get "Row Update" neither "No Row updated"... very confuse..

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    I suspect you need to examine the PHP: db2_stmt_error - Manual function.

    what level of error_reporting are you using?

    I ve seen this sort of problem before on PHP5, its soemthugn to do with how the pHP installation is setup, it used tobe very developer friendly, these days its more aimed a t a production server.

    the fault may well be a syntax error in the included file
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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