我新的PHP和我遇到運行此代碼,當我運行它,瀏覽器顯示什麼麻煩。只是空白。任何人都可以幫助我,確定問題所在。順便說一句,我正在運行一個wamp服務器版本。 2.2因此mysql標籤。這段代碼是針對我創建的數據庫的搜索功能,功能的編輯部分也是一樣的。它在瀏覽器上什麼也沒有顯示。PHP打印功能犯規返回任何
編輯:固定的代碼。儘管桌子上有這種奇怪的輸出,顯示另一個完全空白。 我做了什麼:使用isset()和那裏我們是需要調整示例的變量,我們是$行,我寫$行。
<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 2014-10-11 09:05:04
@SuperDJ我的道歉。我是編程新手,也是新手。會記得下一次。 – 2014-10-11 09:13:23
哪裏與數據庫連接? – 2014-10-11 09:13:54