´ÙÀ½ ÀÌÀü Â÷·Ê

20. ºÎ·Ï J phpDBTest.php3 ¿¹Á¦

Á¦ÃâÀÚ : Joe Thong darkjoe@softhome.net Site URL: http://phpdb.linuxbox.com

¼³¸í: ¿©·¯°¡Áö µ¥ÀÌÅͺ£À̽º ¼­¹ö¿¡¼­ °á°ú Á¶ÀÛÀ» À§ÇÑ °­·ÂÇÑ PHP µ¥ÀÌŸº£À̽º ·¦ÆÛ. µ¥ÀÌÅͺ£À̽ºÀÇ °á°ú°¡ phpDB¿¡ ÀÇÇØ ÀÚµ¿À¸·Î ³ª¿À°Ô µÈ´Ù.

ÀÌÈ­ÀÏÀ» ¾òÀ¸·Á¸é À¥ºê¶ó¿ìÁ®¿¡¼­ '´Ù¸¥À̸§À¸·Î ÀúÀå'À» ´©¸£°í phpDB-mssql.lib ¶ó°í ÀÔ·ÂÇϽÿÀ.(¿ªÁÖ: phpDB-mssql.lib °¡ ¾Æ´Ï°í. phpDBTest.php3 ¶ó°íÇؾßÇÕ´Ï´Ù.)


<html>
< head>
        < title>Untitled< /title>
< /head>

< body>
<?php
        // ÀÌÈ­ÀÏÀº phpDB.inc°¡ ÀÖ´Â µð·ºÅ丮¿¡ ÀÖ´Ù°í °¡Á¤ÇÕ´Ï´Ù.
        include("phpDB.inc");   
        $db = new phpDB();
        $db->pconnect("hostName", "userName", "passWord", "databaseName") or die ("Can't connect to database server or select database");
        $rs = $db->execute("SELECT * FROM Items");
        $numOfRows = $rs->getNumOfRows();
        echo "Number of Rows: $numOfRows";      

        $rs->firstRow(); // ¼±ÅûçÇ×À̳ª, ÃßõÇÕ´Ï´Ù.
        while (!$rs->EOF) {
                // Fields collection accessible as associative arrays too
                echo "<br>" . $rs->fields[0];
                $rs->nextRow(); // NOTE: nextRow() is placed at below
        }

        $rs->close();           
        $db->close();   // ¼±ÅûçÇ×
?>
< /body>
< /html>


´ÙÀ½ ÀÌÀü Â÷·Ê