1. Q: How to use transaction Rollback A: As shown in the following example: $ SQL = "Insert Into E_SHORTCUT SET Admin_ID = 1, function_id = 1, sequence = '0'"; "// or $ sql =" Update E_SHORTCUT SET Admin_id = 1, function_id = 1, sequence = '0' where shortcut_id = '1' ";" "$ db-> autocommit (false);" "如果 If you use non-false / 0 type value [even" -1 'The other of them], the gods can't save you :) "" "" $ db-> simplery ($ SQL); "" // only use Simplery () to support oh "" $ db-> rollback () "" // can also regret "" Note: If the mysql data table must be INNODB can be used ... 2004-8-24 11:13 AM ---- 2. Q: How to connect Database A : Connect with DSN, as follows: $ dsn = 'mysql: // root: @ localhost / test'; $ db = new db; $ db = db :: connect ($ dsn); if (db :: iesrror ($ dB)) {DIE (@db :: errorMessage ($ db));} ... 2004-8-24 11:15 AM - 3. Several common methods: 1. ) Remove all record $ sql = "select * from e_shortcut"; $ RES = $ db-> getAll ($ SQL, $ Params = NULL, $ fetchmode = db_fetchmode_default); {....} 2.) Take the first $ SQL = "Select * from e_shortcut"; $ RES = $ db-> getrow ($ SQL, $ Params = NULL, $ FETCHMODE = DB_FETCHMODE_DEFAULT); {....} 3.) Submit an insert / query / delete Query $ SQL = "Delete from E_SHORTCUT WHERE Shortcut_ID = '1 '";" "// or $ SQL =" Update E_SHORTCUT SET Admin_ID = 1, function_id = 1, sequence =' 0 'Where Shortcut =' 1 '";" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Admin_id = 1, function_id = 1, sequence = '0' ";" $ db-> query ($ SQL); if you want to support transactions, you can use the above method 4.) loop acquisition result $ result = array (); $ SQL = "Select * from e_shortcut1"; $ res = $ db-> query ($ sql); while ($ row = $ r->
Fetchrow ()) {....} ... 2004-8-24 15:20 am ----