SAK }‘ŠÙ

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠÙEƒJƒtƒF ˆê—— SAK Streets ŒŸő
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

PostgreSQL + PHP •Ò1 - Ú‘± pg_connectAƒŒƒR[ƒhŽQÆ pg_fetch_array

ĄPostgreSQL + PHP ƒAƒNƒZƒX

  EPHP ‚̏ꍇAPostgreSQL ‚Ć“ú–{Œê‚đˆ—‚·‚é‚Æ‚«A“ú–{Œê EUC ‚Ć‹Lq‚”‚È
    ‚ą‚ƃGƒ‰[‚É‚È‚éB
    ‚Ü‚œA“ú–{Œê‚đŠÜ‚Țƒf[ƒ^‚đ•\ŽŠ‚·‚éê‡‚́AContent-Type ‚à EUC-JP ‚Æ
    ‚·‚é•K—v‚Ș‚ ‚éB

  EWindows ”Ć PHP ‚́A•W€‚Ć PostgreSQLAMySQL ‚ɃAƒNƒZƒX‚Ć‚«‚éB
    UNIX Œn‚́AƒRƒ“ƒtƒBƒOƒŒ[ƒVƒ‡ƒ“‚ĆŽw’è‚·‚é•K—v‚Ș‚ ‚éB

  EŽŸ‚̃R[ƒh‚́APHP4 ‚Ć‚ ‚éB

<?php
/*
========================================================================
  PostgreSQL Connect Test
========================================================================
*/
?>
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=EUC-JP">
<TITLE>PostgreSQL Connect Test</TITLE>
</HEAD>
<BODY>
<P align="center">-- PostgreSQL Connect Test --</P>
<HR>
<DIV>
<?php
// PostgreSQL Connect
  if (!($cn = pg_connect("host=sak-design port=5432 dbname=sak user=sak password=sak"))) {
    die;
  }

// PostgreSQL Select
  $sql = "select * from testm";
  if (!($rs = pg_exec($sql))) {
    die;
  }

// PostgreSQL Get Records
  $ct = pg_numrows($rs);
  for ($i = 0; $i < $ct; $i++) {
    $item = pg_fetch_array($rs, $i);
    print "${item[0]} ";
    print "${item[1]} ";
    print "${item['„ÇĄŒ„ż2']} ";
    print "${item['„ÇĄŒ„ż3']}<BR>";
  }

// PostgreSQL Disconnect
  pg_close($cn);

// End
  print "<P>Normality end.</P>";
?>
</DIV>
<HR>
</BODY>
</HTML>

Ą‚»‚Ì‘Œ PHP + PostgreSQL ‘€ì

  EwPHP + MySQL •Òx‚ƃ^ƒCƒgƒ‹‚Í‚È‚Á‚Ä‚ą‚Ü‚·‚ȘA
    ‚±‚ż‚ç‚É‚à PHP + PostgreSQL ‚ÌŽ‘—ż‚Ș‚ ‚è‚Ü‚·B

ĄPostgreSQL •ÒAJAVA ServletAJSP •ÒŽ‘—ż
ĄMySQL •ÒŽ‘—ż
ĄSQL Šî‘b•ÒŽ‘—ż
ĄSQL Šî‘bŽÀ’n•ÒŽ‘—ż
ĄSQL ƒ`ƒ…[ƒjƒ“ƒO•ÒŽ‘—ż
ĄOracle PL/SQL •ÒŽ‘—ż
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠÙEƒJƒtƒF ˆê—— SAK Streets ŒŸő



Copyright (C) 1999-2017 Y.SAK