note 36270 deleted from function.mysql-free-result by philip

From: Date: Tue, 20 Jul 2004 01:36:00 +0000
Subject: note 36270 deleted from function.mysql-free-result by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73664@lists.php.net to get a copy of this message
Note Submitter: lew@mailduct.com ---- You can only use mysql_free_result with queries that return result sets. Calling mysql_free_result after a query that does not return a result set will generate an error: PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /prog/...... Do NOT use this for queries such as INSERT, UPDATE, etc. Only use it for queries that actually return result data (as opposed to status data - eg: TRUE/FALSE success info). #### INVALID: $query = "INSERT INTO music VALUES( '12','hip-hop' );" $go = mysql_query( $query ) or die( 'INSERT failed' ); // Free result memory, since we don't need it mysql_free_result( $go ); #### VALID: $query = "SELECT * FROM music WHERE $album=12"; $go = mysql_query( $query ) or die( 'SELECT failed' ); // Free result memory, since we don't need it mysql_free_result( $go ); Hope this helps.

« previous php.notes (#73664) next »