<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could Not Connect: '. mysql_error());
}
// This block grabs the whole list for viewing
$bilboard_list = "";
$bilboard_list0 = "";
$bilboard_list1 = "";
$bilboard_list2 = "";
$bilboard_list3 = "";
$bilboard_list4 = "";
$bilboard_list5 = "";
$bilboard_list6 = "";
$bilboard_list7 = "";
$bilboard_list8 = "";
$bilboard_list9 = "";
$bilboard_list10 = "";
$bilboard_list11 = "";
$bilboard_list12 = "";
$sql = mysql_query("SELECT * FROM maklumat_peribadi ORDER BY id");
$bilboardCount = mysql_num_rows($sql); // count the output amount
if ($bilboardCount > 0) {
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$nama_penuh = $row["nama_penuh"];
$no_ic = $row["no_ic"];
$alamat_ttp = $row["alamat_ttp"];
$no_rumah = $row["no_rumah"];
$no_bimbit = $row["no_bimbit"];
$jantina = $row["jantina"];
$tmpt_lhir = $row["tmpt_lhir"];
$email = $row["email"];
$agama = $row["agama"];
$bangsa = $row["bangsa"];
$negara = $row["negara"];
$nama_penjaga = $row["nama_penjaga"];
$nama_ibu = $row["nama_ibu"];
//for show
$bilboard_list .= "$No<br>";
$bilboard_list0 .= "$Nama<br>";
$bilboard_list1 .= "$No Kad Pengenalan<br>";
$bilboard_list2 .= "$Alamat<br>";
$bilboard_list3 .= "$No Telefon Rumah<br>";
$bilboard_list4 .= "$No Telefon Bimbit<br>";
$bilboard_list5 .= "$Jantina<br>";
$bilboard_list6 .= "$Tempat Lahir<br>";
$bilboard_list7 .= "$Email<br>";
$bilboard_list8 .= "$Agama<br>";
$bilboard_list9 .= "$Bangsa<br>";
$bilboard_list10 .= "$Warganegara<br>";
$bilboard_list11.= "$Nama Penjaga/Bapa<br>";
$bilboard_list12 .= "$Nama Ibu<br>";
}
}
?>
<html>
<head>
<link rel="stylesheet" href="2col_leftNav.css" type="text/css" />
<style type="text/css">
<!--
.style1 {
font-size: 12px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<div id="masthead">
<h1 id="siteName">Admin Site</h1>
<div id="globalNav"> <a href="adminpage.php"> Halaman Utama</a> | <a href="test.php">Maklumat Peribadi Pelajar | <a href="adminpage.php">Senarai Pelajar Mengikut Kursus | <a href="logout.php">Logout</a></div>
</div>
<table width="1000px" border="1" align="center">
<tr>
<td width="auto"><span class="style1"><strong>NO<strong></span></td>
<td width="auto"><span class="style1"><strong>NAMA</strong></td>
<td width="auto"><span class="style1"><strong>NO KAD PENGENALAN</strong></td>
<td width="auto"><span class="style1"><strong>ALAMAT</strong></td>
<td width="auto"><span class="style1"><strong>NO TELEFON RUMAH</strong></td>\
<td width="auto"><span class="style1"><strong>NO TELEFON BIMBIT</strong></td>
<td width="auto"><span class="style1"><strong>JANTINA</strong></td>
<td width="auto"><span class="style1"><strong>TEMPAT LAHIR</strong></td>
<td width="auto"><span class="style1"><strong>EMAIL</strong></td>\
<td width="auto"><span class="style1"><strong>AGAMA</strong></td>
<td width="auto"><span class="style1"><strong>BANGSA</strong></td>
<td width="auto"><span class="style1"><strong>WARGANEGARA</strong></td>
<td width="auto"><span class="style1"><strong>NAMA PENJAGA/BAPA</strong></td>
<td width="auto"><span class="style1"><strong>NAMA IBU</strong></td>
</tr>
<tr>
<td><?php echo $bilboard_list; ?></td>
<td><?php echo $bilboard_list0; ?></td>
<td><?php echo $bilboard_list1; ?></td>
<td><?php echo $bilboard_list2; ?></td>
<td><?php echo $bilboard_list3 ?></td>
<td><?php echo $bilboard_list4; ?></td>
<td><?php echo $bilboard_list5; ?></td>
<td><?php echo $bilboard_list6; ?></td>
<td><?php echo $bilboard_list7; ?></td>
<td><?php echo $bilboard_list8; ?></td>
<td><?php echo $bilboard_list9; ?></td>
<td><?php echo $bilboard_list10; ?></td>
<td><?php echo $bilboard_list11; ?></td>
<td><?php echo $bilboard_list12; ?></td>
</tr>
</table>
<body>
</html>
`
我有这个代码。但是每当我尝试运行此代码时,它都会显示:
警告:mysql_num_rows() 期望参数 1 是资源,布尔值在第 32 行的 D:\xampp\htdocs\ftn_eg\table.php 中给出
任何人都可以帮助我吗?