2008-01-01から1ヶ月間の記事一覧

PHP

クライアントとの接続が切断されているか調べるconnection_aborted()関数 connection_status()関数参考: http://ml.php.gr.jp/pipermail/php-users/2005-September/027523.html http://209.85.175.104/search?q=cache:KnbuOEUdQNsJ:capsulecorp.studio-web.…

PHP

PHPの日付計算

PHP

PHPの日付計算 #今日の日付を取得(タイムスタンプ) $date_today = mktime (0, 0, 0, date("m"), date("d"), date("y")); #一週間前を取得 $date_oneweek = $date_today - 86400 * 7; 86400というのが一日を表しているらしいです。 本日から○日後の日付 echo …

MySQLでINSERTした直後にINSERTしたデータのAUTO_INCREMENT値を取得する

PHP mysql_insert_id() $query = 'insert into table_name ...'; $result = mysql_query($query); $last_id = mysql_insert_id(); MySQL last_insert_id() $query = 'insert into table_name ...'; $result = mysql_query($query); $query = 'select last_in…

php

Smartyテンプレートの方で、Perlのようにループしたいと思ったので、 その処理。 {section name=ループ様変数 loop=配列変数} {$表示する配列[ループ様変数 ]} {/section} 例 PHP $array_data=array(9,8,7,6,5,4,3,2,1); $smarty->assign("data",$array_data…

データベースからのデータの取得は、どれを使うかによって 大量のデータを扱う時には速度が変わってきます。 適切な物を使いましょう〜♪ 基本的な書式 連想配列取得 $row['カラム名'] 数値添字配列取得 $row[0] $row = mysql_fetch_array($result,MYSQL_ASSO…

php

Smartyデビューです。ひとまず、今回はさくらインターネットのレンタルサーバーにSmartyをインストール する方法を記載します。 ・さくらインターネット ・PHP(インスト済み) ・Smarty2.6.18 ? /home/ユーザーID/ 配下に、「Smarty2.6.18.tar.gz」をダウン…