>÷¿¡ Áú¹®À» Àß ¸øÇÑ°Å °°³×¿ä
>Á˼ÛÇϱ¸¿ä
>
>±×³É ¿¬°áÇϸé Àß µÇ¿ä
>¿¹¸¦ µé¾î ½ÇÇàÈÀÏ¿¡¼
>$connect = mysql_connect("¼¹ö¸í", "µðºñ¾ÆÀ̵ð", "Æнº");
>À̸®ÇÏ¸é ¿¡·¯°¡ ¾È³ª´Âµ¥
>
>ÀÎŬ·çµå ÈÀÏ (cgi-bin µð·ºÅ丮¿¡ ÀÖ´Â func.php)------------------------
>
>$mysql_host = `µðºñ¼¹ö¸í`;
>$mysql_db = `µðºñ¸í`;
>$mysql_id = `¾ÆÀ̵ð`;
>$mysql_pw = `Æнº¿öµå`;
>
>include("cgi-bin/func.php");
>
>function page_count($code,$cookie) {
>Global $pres, $total, $todays, $nows, $since, $DOCUMENT_ROOT;
>$todays = date("Y-m-d");
>
>$connect = mysql_connect($mysql_host, $mysql_id, $mysql_pw);<<
>
>À̸®ÇÏ¸é ½ÇÇàÈÀÏ¿¡¼ ¾ËÁö¸¦ ¸øÇϳ׿ä?
>ÀÎŬ·çµå¸¦ À߸ø Çؼ Àΰ¡¿ä?
¾È³çÇϼ¼¿ä, HappyCGI ÆÀÀÇ voposÀÔ´Ï´Ù.
DB connection ºÎºÐÀÌ functionÀ¸·Î µÇ¾îÀÖ´Â µí Çϳ׿ä. function ³»¿¡¼ Àü¿ª
º¯¼ö(global variable)¸¦ ¾²·Á¸é global ½ÃÄÑÁà¾ß ÇÕ´Ï´Ù.
global $mysql_host,$mysql_db,$mysql_id,$mysql_pw;
$connect = mysql_connect .....;
ÀÌ°Ô ¾Æ´Ï¶ó¸é ´Ù½Ã ±Û ¿Ã·ÁÁÖ¼¼¿ä, °¨»çÇÕ´Ï´Ù.
- vopos
|