On 11/05/2007 08:34 PM, Michael Southwell wrote: > One last question: when affected_rows returns -1 (according to the docs) > it "indicates that the query returned an error." My example demonstrates > this by throwing an exception here: > if ( $demo -> affected_rows == -1 ) throw new Exception ( "error > trying to find wines with name “" . $param . '”' ); > > Where is the error that the query returned? It's not in $demo -> error.
Ok so, afaik, the affected_rows are only going to report if it is an 'UPDATE, DELETE, or INSERT' query, otherwise if it is a SELECT query, it will show -1 for affected_rows and ->error will be empty. It may be difficult to make a properly prepared SELECT statement error with a /bad/ bound parameter, ymmv. If you want the row_count from a SELECT query you will want to look at ->store_result (<http://php.net/mysqli_stmt_store_result>) disclaimer: I don't claim to be authoritative on mysqli (actually kinda have a favoritism to postgres :-P,) although I feel my advise is somewhat sound. As all advice, take it with a grain of salt and if I'm wrong, I'm sure someone will speak up... flav _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php
