Warning: Undefined variable $video_img in /nuno21net/www/nariya/lib/content.lib.php on line 837 Warning: Undefined variable $video_img in /nuno21net/www/nariya/lib/content.lib.php on line 837
PHP & Others
Warning: Undefined variable $video_img in /nuno21net/www/nariya/lib/content.lib.php on line 837 Warning: Undefined variable $video_img in /nuno21net/www/nariya/lib/content.lib.php on line 837

[중요]mysql_connect 의 link identifier 다중생성

컨텐츠 정보

본문

http://kr.php.net/manual/kr/function.mysql-connect.php

$a = mysql_connect('a', 'b', 'c');
$b = mysql_connect('a', 'b', 'c');
$c = mysql_connect('a', 'b', 'c');

위와 같은 예가 있을 때, $a만 생성되고 $b, $c 는 $a 를 가리키게 됩니다.

내가 짠 코드가 정상작동 하는줄 알았더니
connect 한번 더 하니까 오동작 하더군요.
원인이 php 의 친절한(?) 기능 덕분이라니-_-;

int mysql_connect ( [string server [, string username [, string password]]])
리퍼런스엔 여기까지만 나와있지만,
소스를 보니 더 있더군요.

$a = mysql_connect('a', 'b', 'c', 1);
$b = mysql_connect('a', 'b', 'c', 2);
$c = mysql_connect('a', 'b', 'c', 3);

이런식으로 하면 새로 생성됩니다. ㅠ_ㅠ 너무 다행.

----------------------------------------------------------------

http://kr.php.net/manual/en/function.mysql-connect.php
en 버전의 문서에는 친절하게 나와 있습니다.

$a = mysql_connect('a', 'b', 'c', true);
$b = mysql_connect('a', 'b', 'c', true);
$c = mysql_connect('a', 'b', 'c', true);

관련자료

댓글 0
등록된 댓글이 없습니다.
Today's proverb
화가 날 때는 참지말고 잊어버려라. 슬프면 엉엉 울어라. 근심걱정이 있으면 몸을 움직여라. 우울할 때는 큰 소리로 노래를 불러라. 용서하라. 미워하면 자기 손해다.