저는 PHP에 익숙하지 않으며 실행했을 때이 코드를 실행하는 데 문제가 있습니다. 브라우저에 아무 것도 표시되지 않습니다. 그냥 비어 있습니다. 아무도 나를 도와, 문제가 무엇인지 결정할 수 없습니다. btw, 나는 wamp 서버 버전을 실행 중입니다. 2.2 그러므로 mysql 태그. 이 코드는 내가 만든 데이터베이스에 대한 검색 기능을위한 것입니다, 또한 함수의 편집 섹션은 동일합니다. 브라우저에는 아무 것도 표시되지 않습니다.php print 함수가 아무 것도 반환하지 않습니다.
수정 : 코드가 수정되었습니다. 비록 테이블에 완전히 다른 공란을 보여주는 이상한 결과물이 있습니다. 나는 무엇을 했습니까 : isset()을 사용했습니다. 우리는 $ row를 썼던 $ 행이라는 예제를 조정할 변수가 있습니다.
<html>
<title>Search Records</title>
<body>
<center>
<?php require 'connect.php' ?>
<?php
//===SEARCH RECORDS===//
if(isset($_GET['search'])=='Search Records')
{
print "<br>Search Records";
print
"<center>
<form method=POST action >
<input type= text size=30 name=mysearch><br>
<input type=submit name=search1 value='Search'>
</center>
</form>";
}
if(isset($_GET['search1'])=='Search')
{
$result=mysql_query
(
"SELECT * FROM employee WHERE
ID LIKE '%$_GET[mysearch]%' or
fname LIKE '%$_GET[mysearch]%' or
mname LIKE '%$_GET[mysearch]%' or
lname LIKE '%$_GET[mysearch]%' or
age LIKE '%$_GET[mysearch]%' or
gender LIKE '%$_GET[mysearch]%' or
dob LIKE '%$_GET[mysearch]%'or
ssn LIKE '%$_GET[mysearch]%' or
salary LIKE '%$_GET[mysearch]%'
order by lname asc"
) or die (mysql_error());
if($_GET['mysearch']==null)
{
print mysql_error();
}
else
$rows=mysql_num_rows($result);
if(isset($rows)!=0)
{
echo "<br>Search Results";
echo "<table border=1 align=center cellspacing=0>";
echo
"<tr align=center>
<td>ID Number</td>
<td>First Name</td>
<td>Middle Name</td>
<td>Last Name</td>
<td>Age</td>
<td>Gender</td>
<td>Date of Birth</td>
<td>Salary</td>
<td>SSN</td>
<td>Action</td>
</tr>";
for($i=0; $i< $rows; $i++)
{
$rows=mysql_fetch_row($result);
echo "<tr align=center>";
echo "<td>$rows[0]</td>";
echo "<td>$rows[1]</td>";
echo "<td>$rows[2]</td>";
echo "<td>$rows[3]</td>";
echo "<td>$rows[4]</td>";
echo "<td>$rows[5]</td>";
echo "<td>$rows[6]</td>";
echo "<td>$rows[7]</td>";
echo "<td>$rows[8]</td>";
echo "<td>[<a href=deleterecords.php?action=Delete&id=$rows[0]>Delete</a>]
[<a href=FreeElec1.php?action=Edit&id=$rows[0]>Edit</a>]</td>";
echo "</tr>";
}
echo "</table>";
echo "<font size=1>Number of entries found: $rows</font>";
echo "<br><br><input type=button value=Back onClick=history.go(-1);return true;>";
}
else
{
echo "<br>No records found!";
echo "<br><input type=button value=Back onClick=history.go(-1);return true;>";
}
mysql_free_result($result);
}
mysql_error();
mysql_close($link);
?>
</center>
</body>
</html>
PHP로 된 스 니펫을 사용할 수 없습니다. html, css, javascript – SuperDJ
@SuperDJ 내 사과. 나는 프로그래밍에 익숙하지 않고 새로운 사이트에 있습니다. 다음에 그걸 기억할거야. –
데이터베이스와의 연결은 어디입니까? –