php搜尋/顯示big5語系的MySQL DB
php搜尋/顯示big5語系的MySQL DB
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=big5">
<title>類別新增</title>
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>
<?php
//----------連接資料庫----------
$condb=mysql_connect("127.0.0.1","root","qwertyuiop");
if(!$condb)
die("error:".mysql_error());
mysql_select_db("webdb",$condb);
//----------連接資料庫----------
if($func==add)
{
//---------- 將類別新增至資料庫中----------
$SQLStr="INSERT INTO cuty (cutyno, cutyname) VALUES('cutyno', '$cutyname')";
mysql_query("SET NAMES 'big5'");
mysql_query("SET CHARACTER SET big5");
mysql_query($SQLStr,$condb);
//---------- 將類別新增至資料庫中 ----------
}
// ----------取出現有類別----------
$SQLStr="SELECT * FROM cuty";
$res=mysql_query($SQLStr,$condb);
//---------- 取出現有類別 ----------
?>
<formname="form1"method="post"action="./code/cuty_add_db.php">
<tablewidth="750"border="1"cellpadding="0"cellspacing="0"align="center" bordercolor="#0000FF">
<tr>
<tdbgcolor="#CCFFFF">
<tablewidth="400"border="0"align="center">
<tr>
<tdwidth="100%"bgcolor="#CCFFFF"align="center">
<fontbgcolor="#0000CC">新增客戶類別</font>
</td>
</tr>
</table>
<tablewidth="750"border="1"cellspacing="0"cellpadding="0" bordercolor="#9999FF">
<tr>
<td>
<tablewidth="750"border="1"cellspacing="0"bgcolor="#FFFFFF">
<tr>
<tdbgcolor="#CCCCCC"align="center">現有客戶類別代碼</td>
<tdbgcolor="#CCCCCC"align="center">現有客戶類別名稱</td>
</tr>
<?
//---------- 取出所有客戶類別名稱並呈現於網頁上----------
mysql_query("SET NAMES 'big5'");
mysql_query("SET CHARACTER SET big5");
$sql="select * from cuty ";
$rows=mysql_query($sql,$condb);
while(list($cutyno,$cutyname)=@mysql_fetch_row($rows)){
echo"
<tr bgcolor='#F7F7F7'>
<td><font size='-1'>$cutyno</font></td>
<td><font size='-1'>$cutyname</font></td>
</tr>
";
}
//---------- 取出所有客戶類別名稱並呈現於網頁上----------
mysql_close($condb);
?>
</table>
</td>
</tr>
</table>
<tablewidth="400"border="0"align="center">
<tr>
<tdbgcolor="#0000CC"align="center"><fontcolor="#FFFFFF">類別</font>
<inputtype="text"name="cutyno">
<inputtype="text"name="cutyname">
<inputtype="submit"name="Submit"value="新增">
</td>
</tr>
</table>
</table>
</form>