{lift}
|
$host="localhost";
$username="rcopt";
$password="rcopt";
$dbname="rcopt";
$link = mysql_connect($host,$username,$password);
mysql_select_db($dbname);
if($add == "เพิ่ม >>")
{
print "";
print "";
}
if($add_01 == "เพิ่ม")
{
$sql_query = "select code from eyes where code='$code_f'";
$result = mysql_query($sql_query);
while($row = mysql_fetch_array($result))
{
$f_code = $row["code"];
}
$n_rows = mysql_numrows($result);
if($n_rows == 0)
{
$sql_insert1 ="INSERT INTO eyes VALUES ('$code_f', '$mean_f', '$detail_f', '$kind_f')";
$success1= mysql_query($sql_insert1);
print " เพิ่มข้อมูลเสร็จสมบูรณ์ ";
}else{
print " มีข้อมูล $f_code นี้ ในฐานข้อมูลไม่สามารถเพิ่มข้อมูลได้ กรุณาลองใหม่อีกครั้ง ";
}
}
if($edit == "แก้ไข >>")
{
print "แก้ไขข้อมูล
>>
";
}
if($search_e == "Search")
{
$sql_query = "select * from eyes where code='$text_e'";
$result = mysql_query($sql_query);
while($row = mysql_fetch_array($result))
{
$f_010 = $row["code"];
$f_020 = $row["mean"];
$f_030 = $row["detail"];
$f_040 = $row["kind01"];
}
$n_rows = mysql_numrows($result);
if($n_rows == 0)
{
//$sql_insert1 ="INSERT INTO eyes VALUES ('$code_f', '$mean_f', '$detail_f', '$kind_f')";
//$success1= mysql_query($sql_insert1);
print " ไม่มีข้อมูล $text_e นี้ ในฐานข้อมูลไม่สามารถแก้ไขข้อมูลได้ กรุณาลองใหม่อีกครั้ง ";
}else{
print "";
}
}
if($edit_01 == "แก้ไข")
{
//print "$code_f1 $mean_f1 $detail_f1 $kind_f1 ";
$sql_insert2 = "update eyes set mean='$mean_f1',detail='$detail_f1',kind01='$kind_f1' where code='$code_f1'";
$success2 = mysql_query($sql_insert2);
print " แก้ไขข้อมูลเสร็จสมบูรณ์ ";
}
if($del == "ลบ >>")
{
print "
ลบข้อมูล
>>
";
}
if($search_d == "Delete")
{
$sql_query = "select code from eyes where code='$text_d'";
$result = mysql_query($sql_query);
while($row = mysql_fetch_array($result))
{
$f_code = $row["code"];
}
$n_rows = mysql_numrows($result);
if($n_rows == 0)
{
print " ไม่มีข้อมูล $text_d นี้ ในฐานข้อมูลไม่สามารถลบข้อมูลได้ กรุณาลองใหม่อีกครั้ง ";
}else{
$sql_insert3 ="delete from eyes where code='$text_d'";
$success3= mysql_query($sql_insert3);
print " ลบข้อมูลเสร็จสมบูรณ์ ";
}
}
mysql_close($link);
?>
|
|
|
|