So I am having a bit of problems and I am not entirely sure what is going on. Currently, I have something in my php code that allows me to insert a new type id.
Dont worry about the extra calls but that inserts correctly and creates the information.Code:try { $this->db->connect()->getHandler()->beginTransaction(); $stmt = $this->db ->query("INSERT INTO tbl_TokenType (name) VALUES (?)") ->exe(array($name)) ->getStatement(); if ( !$stmt ) { throw new Exception('Failed to insert'); } $this->db->getHandler()->commit(); $this->db->close(); } catch (Exception $e) { $this->db->rollback(); } return $this;
Now if I try to insert something larger eg:
If fails to insert for some unknown reason; however, it doesnt throw any issue in the catch. Not sure what is going on...Code:try { $this->db->connect()->getHandler()->beginTransaction(); $stmt = $this->db ->query("INSERT INTO tbl_Account (Active, Banned, Confirmed, Email, AccountLevel, MaxProfiles) VALUES (:Active, :Banned, :Confirmed, :Email, :AccountLevel, :MaxProfiles)") ->exe(array( "Active" => 1, "Banned" => 0, "Confirmed" => 0, "Email" => $email, "AccountLevel" => 1, "MaxProfiles" => 10 )) ->getStatement(); if ( !$stmt ) { throw new Exception('Failed to insert'); } $this->db->getHandler()->commit(); $id = $this->db->getHandler()->lastInsertId(); $this->db->close(); } catch(Exception $e) { $this->db->rollback(); $id = 0; $message = $e->getMessage(); }
Any ideas would be great. Oh another note the following code works directly from the db:
I am completely stumpedCode:INSERT INTO tbl_Account (Active, Banned, Confirmed, Email, AccountLevel, MaxProfiles) VALUES (1,0,0,'someemail@yahoo.com',1,10)



Reply With Quote
Bookmarks