ID: 40377 User updated by: burg1 at gmx dot net -Summary: mysql_query: return the actual MySQL output, not just TRUE Reported By: burg1 at gmx dot net Status: Open -Bug Type: Feature/Change Request +Bug Type: Documentation problem -PHP Version: 5.2.0 +PHP Version: Irrelevant New Comment:
Sorry for the original post - I've just noticed that this feature is already implemented ;-) So this feature request transforms into a documentation problem: mysql_query() doesn't only return a resource for SELECT, SHOW, DESCRIBE or EXPLAIN commands (as stated in the docs), but also for other types of commands which return an output - at least for ANALYZE TABLE and OPTIMIZE TABLE (don't know if there exist other MySQL commands like this) Code to check: $result = mysql_query("ANALYZE TABLE tablename"); print_r (mysql_fetch_row($result)); Previous Comments: ------------------------------------------------------------------------ [2007-02-06 21:21:13] burg1 at gmx dot net Description: ------------ Currently, the mysql_query() function returns a resource only on some commands (SELECT, SHOW, DESCRIBE or EXPLAIN). On any other command, it just returns TRUE. My suggestion: Let the function return the actual MySQL output on those "other commands" (I'm talking about commands like ANALYZE TABLE that do generate an output). Could be given as an associative array, or if that's not possible, just as a string. This way, mysql_query would return: *) a resource on SELECT, SHOW, DESCRIBE or EXPLAIN *) an array/string on commands that give an output (OPTIMIZE TABLE, etc.) *) TRUE on commands that don't give an output (DELETE, etc.) *) FALSE on error ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40377&edit=1