$theTitle=wp_title(" - ", false); if($theTitle != "") { ?>
WordPressのカスタマイズとプラグイン、CSSテクニック、SEOの話題など。
In: WordPress
18 5月 2010WordPressで、こんなエラーが出た人ー。(はーい)
Warning: mysql_error(): 9 is not a valid MySQL-Link resource in /home/dacelo/wordpress/wp-includes/wp-db.php on line 615
WordPress上で、何か別のPHPプログラムを実行したりしていませんか。
これは、MySQLデータベースへのコネクトが被っているために出ているエラーです。
じゃあこういう場合はどうすればいいのかというと、MySQL4.2以降のmysql_connectには、[new_link]というパラメータがあり、これで複数の接続が出来るようになっています!
マニュアルを見てみましょう。
new_link
If a second call is made to mysql_connect() with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned. The new_link parameter modifies this behavior and makes mysql_connect() always open a new link, even if mysql_connect() was called before with the same parameters. In SQL safe mode, this parameter is ignored.
具体的に例を挙げると、
これを…
$conn = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$conn){ die("db connect Error"); }
こうします。
$conn = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, true); if(!$conn){ die("db connect Error"); }
これで表題のエラーは表示されなくなるはずです。
Related posts:
Related posts brought to you by Yet Another Related Posts Plugin.
ここは、SE見習いである私ことdaceloが、日夜習得していくシステム関連の備忘録、phpやWordPressTipsのネタ、あるいはSEOやWebマーケティング関連の雑感を投稿するブログです。 平日は大体毎日投稿しています。土日は休業日です。
1 Response to エラー : Warning: mysql_error(): 9 is not a valid MySQL-Link
トラックバックURL:daceloweb
5月 18th, 2010 at 5:13 PM
更新しております→: エラー : Warning: mysql_error(): 9 is not a valid MySQL-Link (http://bit.ly/bBHVmf )