help with PHP transactions
Posted: Tue May 13, 2008 6:32 pm
My table is not updating why?
Here is the create table stuff
mysql> create table Bank(
-> accID int not null,
-> balance float (10,2) not null,
-> Primary Key (accID));
Query OK, 0 rows affected (0.06 sec)
mysql> Insert into Bank (accID,balance) values (6,1000.00);
Query OK, 1 row affected (0.01 sec)
mysql> Alter table Bank ENGINE=innoDB;
Query OK, 1 row affected (0.06 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> Set autocommit=0;
Query OK, 0 rows affected (0.00 sec)
Here is the code:
Here is the create table stuff
mysql> create table Bank(
-> accID int not null,
-> balance float (10,2) not null,
-> Primary Key (accID));
Query OK, 0 rows affected (0.06 sec)
mysql> Insert into Bank (accID,balance) values (6,1000.00);
Query OK, 1 row affected (0.01 sec)
mysql> Alter table Bank ENGINE=innoDB;
Query OK, 1 row affected (0.06 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> Set autocommit=0;
Query OK, 0 rows affected (0.00 sec)
Here is the code:
Code: Select all
<?php
mysql_connect("localhost","fierm","13183");
mysql_select_db(fierm);
mysql_query("BEGIN");
$result = mysql_query("Update Bank set balance='5000.00' where accID='6'");
echo "here";
if($result){
mysql_query("COMMIT");
}
else{
echo "failed";
}
?>