summaryrefslogtreecommitdiff
path: root/ext/mysql/php_mysql.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-09-06 05:21:45 +0000
committerZeev Suraski <zeev@php.net>1999-09-06 05:21:45 +0000
commitf3e63d9e71bf1c169b7a55a38f67bac4e9561712 (patch)
treecfc62004092728daebea5dfa76ff6eb6d8bf72aa /ext/mysql/php_mysql.c
parentcb25b1222e2b84e49022463e01d8a1f642940438 (diff)
downloadphp-git-f3e63d9e71bf1c169b7a55a38f67bac4e9561712.tar.gz
Fix the 4.0 tree (forgot to commit)
Diffstat (limited to 'ext/mysql/php_mysql.c')
-rw-r--r--ext/mysql/php_mysql.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index 436b1bd871..e3a2326fce 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -85,6 +85,9 @@ static int le_result,le_link,le_plink;
#define MYSQL_NUM 1<<1
#define MYSQL_BOTH (MYSQL_ASSOC|MYSQL_NUM)
+#define PHP_MYSQL_VALID_RESULT(mysql) \
+ (mysql_num_fields(mysql)>0)
+
function_entry mysql_functions[] = {
PHP_FE(mysql_connect, NULL)
PHP_FE(mysql_pconnect, NULL)
@@ -822,7 +825,7 @@ PHP_FUNCTION(mysql_query)
}
#endif
if ((mysql_result=mysql_store_result(mysql))==NULL) {
- if (mysql_num_fields(mysql_result)>0) { /* query should have returned rows */
+ if (PHP_MYSQL_VALID_RESULT(mysql)) { /* query should have returned rows */
php_error(E_WARNING, "MySQL: Unable to save result set");
RETURN_FALSE;
} else {
@@ -883,7 +886,7 @@ PHP_FUNCTION(mysql_db_query)
}
#endif
if ((mysql_result=mysql_store_result(mysql))==NULL) {
- if (mysql_num_fields(mysql_result)>0) { /* query should have returned rows */
+ if (PHP_MYSQL_VALID_RESULT(mysql)) { /* query should have returned rows */
php_error(E_WARNING, "MySQL: Unable to save result set");
RETURN_FALSE;
} else {