拡張子:txtvbswsfjsphpjavahtmlutf8sjis CREATE TABLE `acounter` ( `PAGE_NAME` varchar(8) NOT NULL default '', `PAGE_COUNT` int(11) default NULL, PRIMARY KEY (`PAGE_NAME`) ) ページ(PAGE_NAME)毎に行を使用してアクセス回数(PAGE_COUNT)を更新します ※ この段階では、テーブルの行を事前に作成して、PAGE_COUNT を整数で初期化する必要があります 拡張子:txtvbswsfjsphpjavahtmlutf8sjis <? header( "Content-Type: text/html; Charset=EUC-JP" ); header( "Expires: Wed, 31 May 2000 14:59:58 GMT" ); require_once( "http://lightbox.in.coocan.jp/gen/db.txt"); $conf_db_type = 1; $SQL = new DB( "サーバー","DB","ユーザー","パスワード" ); $SQL->Debug = true; $Query = "update acounter set PAGE_COUNT = PAGE_COUNT + 1"; $Query .= " where PAGE_NAME = 'R205'"; $SQL->Execute( $Query ); $Query = "select * from acounter"; $Query .= " where PAGE_NAME = 'R205'"; $Column = $SQL->QueryEx( $Query ); $OUT_DATA = $Column["PAGE_COUNT"]; $SQL->Close(); ?> <HTML> <HEAD> <META http-equiv="Content-type" content="text/html; charset=euc-jp" /> <TITLE>HTML雛形</TITLE> <STYLE type="text/css"> * { font-size: 12px; } </STYLE> </SCRIPT> </HEAD> <BODY> <PRE> <?= $OUT_DATA ?> </PRE> </BODY> </HTML> 以下では、ページに対象とする行が存在しない場合に自動的に行 を insert します 拡張子:txtvbswsfjsphpjavahtmlutf8sjis <? header( "Content-Type: text/html; Charset=EUC-JP" ); header( "Expires: Wed, 31 May 2000 14:59:58 GMT" ); require_once( "http://lightbox.in.coocan.jp/gen/db.txt"); $conf_db_type = 1; $SQL = new DB( "サーバー","DB","ユーザー","パスワード" ); $SQL->Debug = true; $Query = "update acounter set PAGE_COUNT = PAGE_COUNT + 1"; $Query .= " where PAGE_NAME = 'NEW_PAGE'"; $SQL->Execute( $Query ); $ret = mysql_affected_rows( $SQL->Connect ); if ( $ret == 0 ) { $Query = "insert into acounter (PAGE_NAME,PAGE_COUNT)"; $Query .= " values('NEW_PAGE',1)"; $SQL->Execute( $Query ); } $Query = "select * from acounter"; $Query .= " where PAGE_NAME = 'NEW_PAGE'"; $Column = $SQL->QueryEx( $Query ); $OUT_DATA = $Column["PAGE_COUNT"]; $SQL->Close(); ?> <HTML> <HEAD> <META http-equiv="Content-type" content="text/html; charset=euc-jp" /> <TITLE>HTML雛形</TITLE> <STYLE type="text/css"> * { font-size: 12px; } </STYLE> </SCRIPT> </HEAD> <BODY> <PRE> <?= $OUT_DATA ?> </PRE> </BODY> </HTML>
CREATE TABLE `acounter` ( `PAGE_NAME` varchar(8) NOT NULL default '', `PAGE_COUNT` int(11) default NULL, PRIMARY KEY (`PAGE_NAME`) )
<? header( "Content-Type: text/html; Charset=EUC-JP" ); header( "Expires: Wed, 31 May 2000 14:59:58 GMT" ); require_once( "http://lightbox.in.coocan.jp/gen/db.txt"); $conf_db_type = 1; $SQL = new DB( "サーバー","DB","ユーザー","パスワード" ); $SQL->Debug = true; $Query = "update acounter set PAGE_COUNT = PAGE_COUNT + 1"; $Query .= " where PAGE_NAME = 'R205'"; $SQL->Execute( $Query ); $Query = "select * from acounter"; $Query .= " where PAGE_NAME = 'R205'"; $Column = $SQL->QueryEx( $Query ); $OUT_DATA = $Column["PAGE_COUNT"]; $SQL->Close(); ?> <HTML> <HEAD> <META http-equiv="Content-type" content="text/html; charset=euc-jp" /> <TITLE>HTML雛形</TITLE> <STYLE type="text/css"> * { font-size: 12px; } </STYLE> </SCRIPT> </HEAD> <BODY> <PRE> <?= $OUT_DATA ?> </PRE> </BODY> </HTML>
<? header( "Content-Type: text/html; Charset=EUC-JP" ); header( "Expires: Wed, 31 May 2000 14:59:58 GMT" ); require_once( "http://lightbox.in.coocan.jp/gen/db.txt"); $conf_db_type = 1; $SQL = new DB( "サーバー","DB","ユーザー","パスワード" ); $SQL->Debug = true; $Query = "update acounter set PAGE_COUNT = PAGE_COUNT + 1"; $Query .= " where PAGE_NAME = 'NEW_PAGE'"; $SQL->Execute( $Query ); $ret = mysql_affected_rows( $SQL->Connect ); if ( $ret == 0 ) { $Query = "insert into acounter (PAGE_NAME,PAGE_COUNT)"; $Query .= " values('NEW_PAGE',1)"; $SQL->Execute( $Query ); } $Query = "select * from acounter"; $Query .= " where PAGE_NAME = 'NEW_PAGE'"; $Column = $SQL->QueryEx( $Query ); $OUT_DATA = $Column["PAGE_COUNT"]; $SQL->Close(); ?> <HTML> <HEAD> <META http-equiv="Content-type" content="text/html; charset=euc-jp" /> <TITLE>HTML雛形</TITLE> <STYLE type="text/css"> * { font-size: 12px; } </STYLE> </SCRIPT> </HEAD> <BODY> <PRE> <?= $OUT_DATA ?> </PRE> </BODY> </HTML>