> if(!mysql_query($array[$i])) { > $flag = false; > break; > } > > after the loop I do > if($flag) > mysql_query("commit"); > else > mysql_query("rollback");
Be careful with that last if() statement. I would either change the script to read '$flag = true' or 'if( isset($flag) )' It's quite possible that I'm mistaken, but I believe that 'if($flag)' would evaluate to false if '$flag = false'. Edward Dudlik Becoming Digital www.becomingdigital.com ----- Original Message ----- From: "Jonas Geiregat" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, 17 June, 2003 15:19 Subject: Re: transactions with php Becoming Digital wrote: > I found one item in the PHP Classes Repository that may be of use. > Unfortunately, the comments are in Spanish, so it's up to you to > figure out the > code. > http://promoxy.mirrors.phpclasses.org/browse.html/file/3077.html > > Edward Dudlik > Becoming Digital > www.becomingdigital.com > > > ----- Original Message ----- > From: "Jonas Geiregat" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, 17 June, 2003 13:44 > Subject: transactions with php > > > I'm trying to implement transaction (mysql) in my php code. Could anyone > tell me if this is a good way of using them. I make an array with all > the query's I loop through them. like this mysql_query($qarray[$i])or > die($flag = false);. After the loop I do if($flag) commit; else rollback; > Is this a good way of implementing them ? > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > > > > > > This is a much better implementation then my previous one I loop trough a array with query's. in the loop I do: if(!mysql_query($array[$i])) { $flag = false; break; } after the loop I do if($flag) mysql_query("commit"); else mysql_query("rollback"); This should work haven't tested it yet. If anyone got better idea's Post them Regards Jonas Geiregat -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]