one thing i really love in perl is the block eval {} structure, which is similar to try/catch/throw in java and other languages.
i'm missing it a lot in php. is there a way to simulate it? for instance, say i have a bunch of database commands. in perl, i would do something like (pseudocode): eval { db_connect() or die "connection failed"; set auto raise errors on db connection; select statement; insert statement; whatever... and so on... }; if ($@) { print "db error in block: $@" } the idea being that if any of the commands in the block fail, the database package automatically does a die("") and the block is terminated. the nearest i could get with php is: do { mysql_query("UPDATE ..."); if (mysql_error()) { $error.="Couldn't update: ". mysql_error(); break; } mysql_query("SELECT ..."); if (mysql_error()) { $error.="Couldn't select: ". mysql_error(); break; } and so on.... } while (0==1); if ($error) { do error stuff } else { it worked } it's ugly and there's a lot of extra checking of mysql_error and the like. has anybody figured out a better way? -jsd- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]