華府江山 http://203.72.56.8/phpBB3/ |
|
write_program http://203.72.56.8/phpBB3/viewtopic.php?f=42&t=704 |
第 1 頁 (共 1 頁) |
發表人: | alex [ 2011年 11月 4日, 11:05 ] |
文章主題 : | write_program |
<?php $hostname_contact_conn = "127.0.0.1"; $database_contact_conn = "guestbook"; $username_contact_conn = "user"; $password_contact_conn = "123456"; $contact_conn = mysql_pconnect($hostname_contact_conn, $username_contact_conn, $password_contact_conn) or trigger_error(mysql_error(),E_USER_ERROR); $db_selected = mysql_select_db ('test' , $contact_conn ) or die ( 'Can\'t use the database : ' . mysql_error() ) ; mysql_query("SET NAMES 'utf8'"); mysql_query('SET CHARACTER_SET_CLIENT=utf8'); mysql_query('SET CHARACTER_SET_RESULTS=utf8'); mysql_query('SET default-character-set=utf8'); session_start() ; // php.ini 內的 output_buffering 要設成 4096,以免產生錯誤 date_default_timezone_set( "Asia/Taipei" ) ; ?> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <?php // echo $_REQUEST['guest_name'] . "<br />" ; if( $_REQUEST['guest_name'] ) { $insertSQL = sprintf("INSERT INTO guestbook (`name`, `email`, `datetime`, `comment`) VALUES ('%s', '%s', '%s', '%s')", iconv('big5','utf-8',$_REQUEST['guest_name']) , $_REQUEST['guest_email'] , date("Y-m-d H:i:s") , iconv('big5','utf-8',$_REQUEST['guest_comment']) ) ; echo "<br />" . $insertSQL . "<br />" ; $result = mysql_query($insertSQL) or die("<b>error</b>: failed to execute query <i>$query</i>"); mysql_close($contact_conn); //$desiredContent = mysql_fetch_array($result, MYSQL_ASSOC); //mysql_free_result($result); print "response : saved."; } ?> |
第 1 頁 (共 1 頁) | 所有顯示的時間為 UTC + 8 小時 |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |