If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > Update from form on db2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-11-09, 08:40
jazzjansen jazzjansen is offline
Registered User
 
Join Date: Oct 2009
Posts: 5
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 09:25.
Reply With Quote
  #2 (permalink)  
Old 11-11-09, 08:58
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
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 my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 11-11-09, 09:00
jazzjansen jazzjansen is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 11-11-09, 09:13
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
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 my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #5 (permalink)  
Old 11-11-09, 09:20
jazzjansen jazzjansen is offline
Registered User
 
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..
Reply With Quote
  #6 (permalink)  
Old 11-11-09, 10:29
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
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 my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On