downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

> <リソース型
[edit] Last updated: Fri, 10 Feb 2012

view this page in

定義済み定数

以下の定数が定義されています。 この関数の拡張モジュールが PHP 組み込みでコンパイルされているか、 実行時に動的にロードされている場合のみ使用可能です。

PHP 4.3.0 以降では、mysql_connect()mysql_pconnect() で追加のクライアントフラグを 指定できるようになりました。以下の定数が定義されています。

MySQL クライアント定数
定数 説明
MYSQL_CLIENT_COMPRESS 圧縮プロトコルを利用します。
MYSQL_CLIENT_IGNORE_SPACE 関数名の後のスペースを許可します。
MYSQL_CLIENT_INTERACTIVE interactive_timeout で指定された秒数(wait_timeout のかわり) の無通信が続くまで接続を閉じません。
MYSQL_CLIENT_SSL SSL による暗号化を使用します。このフラグは、バージョン 4.x 以降の MySQL クライアントライブラリを利用している場合にのみ有効です。 PHP 4 や、Windows 版の PHP 5 にバンドルされているのは、バージョン 3.23.x のライブラリです。

mysql_fetch_array() 関数は、結果の配列の形式を 指定するための定数を使用します。以下の定数が定義されています。

MySQL フェッチ定数
定数 説明
MYSQL_ASSOC カラムは、フィールド名を添字とする配列形式で返されます。
MYSQL_BOTH カラムは、数値の添字とフィールド名の添字のどちらでもアクセスできる 配列形式で返されます。
MYSQL_NUM カラムは、数値の添字を持つ配列形式で返されます。添字は 0 からはじまり、 結果の最初のフィールドです。



> <リソース型
[edit] Last updated: Fri, 10 Feb 2012
 
add a note add a note User Contributed Notes 定義済み定数
frak at gingerhq dot net 30-Jun-2011 08:06
If you're using stored procedures and mysql_error() returns "PROCEDURE storedProcedureName can't return a result set in the given context", you need to pass an additional flag (CLIENT_MULTI_RESULTS) to mysql_connect() as such:
mysql_connect($hostname, $username, $password, true, 131072);

Some other sources say that you should use 65536. 65536 is actually the flag to allow multiple statements in a single mysql_query(), and is a security issue. The reason it allows you to receive results from stored procedures is because it implies 131072. To be safe, use 131072 over 65536.
pcdinh at phpvietnam dot net 13-Feb-2010 09:54
Other client flags extracted from MySQL client source

#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
#define CLIENT_LONG_FLAG 4 /* Get all column flags */
#define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */
#define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */
#define CLIENT_COMPRESS 32 /* Can use compression protocol */
#define CLIENT_ODBC 64 /* Odbc client */
#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */
#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */
#define CLIENT_PROTOCOL_41 512 /* New 4.1 protocol */
#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */
#define CLIENT_SSL 2048 /* Switch to SSL after handshake */
#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */
#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */
#define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31)
Contact at LinuxIntro dot com 28-Oct-2008 06:33
When you connect and expect to use a stored procedure,you must pass a special flag to MySQL via the connect command, otherwise you will not get the results returned, and it will result in this error:
PROCEDURE AlexGrim.GetStats_ForumCategories can't return a result set in the given context

To fix this, change you connection string, adding ",false,65536" as the last 2 fields:
$this->con = mysql_connect($this->h,$this->u,$this->p,false,65536);

 
show source | credits | stats | sitemap | contact | advertising | mirror sites