|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-02-06 21:21 UTC] 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 23:00:01 2025 UTC |
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));