my.cnfを設定する

設定の確認↓

mysql> status
--------------
mysql  Ver 14.7 Distrib 4.1.22, for redhat-linux-gnu (x86_64) using readline 4.3
|
|
|
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn.  characterset:    latin1
|
|
|
--------------

インストール直後の文字コードを見ると”latin1″とかになっているので、
コレをunicodeに変更します。

/etc とかにあるmy.cnfを設定。
それぞれの項目に以下を追加します。

[mysqld]
default-character-set=utf8
skip-character-set-client-handshake
[client]
default-character-set = utf8
[mysqldump]
default-character-set = utf8
[mysql]
default-character-set = utf8

mysqldを再起動。

#service mysqld restart

mysqlを起動して設定を確認すると。。。

mysql> status
--------------
mysql  Ver 14.7 Distrib 4.1.22, for redhat-linux-gnu (x86_64) using readline 4.3
|
|
|
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
|
|
|
mysql>

http://d.hatena.ne.jp/shimonoakio/20080129/1201609465
http://tod.cocolog-nifty.com/diary/2005/12/xamppphpmysql_6279.html

useradd

ユーザーの追加

useradd [ユーザー名]

パスワードの設定

# passwd [ユーザー名]
Changing password for user *******
New UNIX password: ←入力する
Retype new UNIX password: ←入力する
passwd: all authentication tokens updated successfully.
#

ページへジャンプする。

htmlのメタタグを出力してジャンプする。

ex.プライバシーポリシーなどの確認ページから押されたボタンによって異なるページを読み込むとき↓

if($confirm == "yes"){
     echo("<META HTTP-EQUIV=Refresh CONTENT=0;URL='hogehoge.php'>\n");
}elseif($confirm == "no"){
     echo("<META HTTP-EQUIV=Refresh CONTENT=0;URL='index.php'>\n");
}

“yes”なら hogehoge.php へ、
“no”なら index.php へジャンプします。

::参考URL::::

http://phpnet.blog91.fc2.com/blog-entry-19.html
http://tuevin.jugem.jp/?eid=51
http://blog.tommmmy.com/2007/03/post_3.html

配列の○番目から○番目までを取り出す。


array_slice($array, [何番目から], [何個]);

$array = ("い", "ろ", "は", "に", "ほ");
$sliced_array = array_slice($array, 0, 3); ← い、ろ、は が新しい配列の中に格納されます。
$sliced_array = array_slice($array, 2); ← は、に、ほ が新しい配列の中に格納れます。

改訂3版 基礎PHP (IMPRESS KISO SERIES)
Array
インプレスジャパン
売り上げランキング: 127036