01.
<?php
require_once
(
'Connections/MyConnect.php'
); ?>
02.
<?php
03.
if
(!function_exists(
"GetSQLValueString"
)) {
04.
function
GetSQLValueString(
$theValue
,
$theType
,
$theDefinedValue
=
""
,
$theNotDefinedValue
=
""
)
05.
{
06.
if
(PHP_VERSION < 6) {
07.
$theValue
= get_magic_quotes_gpc() ?
stripslashes
(
$theValue
) :
$theValue
;
08.
}
09.
10.
$theValue
= function_exists(
"mysql_real_escape_string"
) ? mysql_real_escape_string(
$theValue
) : mysql_escape_string(
$theValue
);
11.
12.
switch
(
$theType
) {
13.
case
"text"
:
14.
$theValue
= (
$theValue
!=
""
) ?
"'"
.
$theValue
.
"'"
:
"NULL"
;
15.
break
;
16.
case
"long"
:
17.
case
"int"
:
18.
$theValue
= (
$theValue
!=
""
) ?
intval
(
$theValue
) :
"NULL"
;
19.
break
;
20.
case
"double"
:
21.
$theValue
= (
$theValue
!=
""
) ? doubleval(
$theValue
) :
"NULL"
;
22.
break
;
23.
case
"date"
:
24.
$theValue
= (
$theValue
!=
""
) ?
"'"
.
$theValue
.
"'"
:
"NULL"
;
25.
break
;
26.
case
"defined"
:
27.
$theValue
= (
$theValue
!=
""
) ?
$theDefinedValue
:
$theNotDefinedValue
;
28.
break
;
29.
}
30.
return
$theValue
;
31.
}
32.
}
33.
34.
mysql_select_db(
$database_MyConnect
,
$MyConnect
);
35.
$query_Showdata
=
"SELECT * FROM resultat"
;
36.
$Showdata
= mysql_query(
$query_Showdata
,
$MyConnect
)
or
die
(mysql_error());
37.
$row_Showdata
= mysql_fetch_assoc(
$Showdata
);
38.
$totalRows_Showdata
= mysql_num_rows(
$Showdata
);
39.
?>
42.
<head>
43.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
44.
<title>Untitled Document</title>
45.
<style type=
"text/css"
>
46.
body p {
47.
text-align: center;
48.
}
49.
body table tr td {
50.
text-align: center;
51.
}
52.
</style>
53.
</head>
54.
55.
<body bgcolor=
"#CCCCCC"
>
56.
<p><a href=
"insert.php"
>เพิ่มข้อมูลใหม่</a></p>
57.
<p> </p><center>
58.
<form id=
"form1"
name=
"form1"
method=
"post"
action=
"search.php"
>
59.
<label
for
=
"word"
>ค้นหา</label>
60.
<input type=
"text"
name=
"word"
id=
"word"
/>
61.
ค้นหา2
62.
<input type=
"text"
name=
"word2"
id=
"word3"
/>
63.
<input type=
"submit"
name=
"btnsearch"
id=
"btnsearch"
value=
"Submit"
/>
64.
</form>
65.
<p> </p></center>
66.
<table border=
"1"
align=
"center"
>
67.
<tr>
68.
<td width=
"103"
align=
"center"
bgcolor=
"#0066CC"
><span style=
"color:#FFFFFF"
>รหัส</span></td>
69.
<td width=
"129"
align=
"center"
bgcolor=
"#0066CC"
><span style=
"color:#FFFFFF"
>ชื่อ</span></td>
70.
<td width=
"115"
align=
"center"
bgcolor=
"#0066CC"
><span style=
"color:#FFFFFF"
>อายุ</span></td>
71.
<td width=
"128"
align=
"center"
bgcolor=
"#0066CC"
><span style=
"color:#FFFFFF"
>อีเมล</span></td>
72.
<td width=
"44"
align=
"center"
bgcolor=
"#0066CC"
><span style=
"color:#FFFFFF"
>
Delete
</span></td>
73.
<td width=
"50"
align=
"center"
bgcolor=
"#0066CC"
><span style=
"color:#FFFFFF"
>Edit</span></td>
74.
75.
</tr>
76.
<?php
do
{ ?>
77.
<tr>
78.
<td bgcolor=
"#FFFFFF"
><?php
echo
$row_Showdata
[
'id'
]; ?></td>
79.
<td bgcolor=
"#FFFFFF"
><?php
echo
$row_Showdata
[
'name'
]; ?></td>
80.
<td bgcolor=
"#FFFFFF"
><?php
echo
$row_Showdata
[
'age'
]; ?></td>
81.
<td bgcolor=
"#FFFFFF"
><?php
echo
$row_Showdata
[
'email'
]; ?></td>
82.
<td bgcolor=
"#FFFFFF"
><a href=
"delete.php?id=<?php echo $row_Showdata['id']; ?>"
>ลบ</a></td>
83.
<td bgcolor=
"#FFFFFF"
><a href=
"update.php?id=<?php echo $row_Showdata['id']; ?>"
>แก้ไข</a></td>
84.
</tr>
85.
<?php }
while
(
$row_Showdata
= mysql_fetch_assoc(
$Showdata
)); ?>
86.
</table>
87.
</body>
88.
</html>
89.
<?php
90.
mysql_free_result(
$Showdata
);
91.
?>