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_connectAƒŒƒR[ƒhŽQÆ pg_fetch_array

¡PostgreSQL + PHP ƒAƒNƒZƒX

  EPHP ‚Ìê‡APostgreSQL ‚Å“ú–{Œê‚ðˆ—‚·‚é‚Æ‚«A“ú–{Œê EUC ‚Å‹Lq‚µ‚È
    ‚¢‚ƃGƒ‰[‚É‚È‚éB
    ‚Ü‚½A“ú–{Œê‚ðŠÜ‚Þƒf[ƒ^‚ð•\Ž¦‚·‚éꇂÍAContent-Type ‚à EUC-JP ‚Æ
    ‚·‚é•K—v‚ª‚ ‚éB

  EWindows ”Å PHP ‚ÍA•W€‚Å PostgreSQLAMySQL ‚Ƀ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 ‘€ì

  EwPHP + MySQL •Òx‚ƃ^ƒCƒgƒ‹‚Í‚È‚Á‚Ä‚¢‚Ü‚·‚ªA
    ‚±‚¿‚ç‚É‚à PHP + PostgreSQL ‚ÌŽ‘—¿‚ª‚ ‚è‚Ü‚·B

¡PostgreSQL •ÒAJAVA ServletAJSP •ÒŽ‘—¿
¡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-2024 Y.SAK