使用php显示单个数据库记录

时间:2014-01-09 14:02:30

标签: php mysql

请尝试使用php显示mysql数据库的各个reocords,沿着我得到错误的行 * mysql_fetch_array()期望参数1是资源,在C:\ wamp \ www \ NASU \中给出布尔值第28行的fetchall.php *

我的代码如下......

<?php

$conn = mysql_connect("localhost","root","");


mysql_select_db("tblr", $conn);


$rs = mysql_query("SELECT * FROM tblr");


while ($row = mysql_fetch_array($rs)) {

?>

<center>

<div class="m">

<form name="register" method="post" action="">
<fieldset><legend>Report</legend>

<div class="a"><div class="l">Name</div><div class="r"><?php echo $row['name1'] ?></div></div>

<div class="a"><div class="l">ID No.</div><div class="r"><?php echo $row['id'] ?></div></div>

<div class="a"><div class="l">Bank</div><div class="r"><?php echo $row['bank'] ?></div></div>

<div class="a"><div class="l">Account Number</div><div class="r"><?php echo $row['accno'] ?></div></div>

<div class="a"><div class="l">Opening Balance</div><div class="r"><?php echo $row['ob'] ?></div></div>

<div class="head1">Month</div>
<div class="head2">savings</div>
<div class="head3">Withdrawal</div>

<div class="a"><div class="l">January</div><div class="r"><?php echo $row['january'] ?><?php echo $row['januaryw'] ?></div></div>

<div class="a"><div class="l">February</div><div class="r"><?php echo $row['february'] ?><?php echo $row['februaryw'] ?></div></div>

<div class="a"><div class="l">March</div><div class="r"><?php echo $row['march'] ?><?php echo $row['marchw'] ?></div></div>

<div class="a"><div class="l">April</div><div class="r"><?php echo $row['april'] ?><?php echo $row['april'] ?></div></div>

<div class="a"><div class="l">May</div><div class="r"><?php echo $row['may'] ?><?php echo $row['mayw'] ?></div></div>

<div class="a"><div class="l">June</div><div class="r"><?php echo $row['june'] ?><?php echo $row['junew'] ?></div></div>

<div class="a"><div class="l">July</div><div class="r"><?php echo $row['july'] ?><?php echo $row['julyw'] ?></div></div>

<div class="a"><div class="l">August</div><div class="r"><?php echo $row['august'] ?><?php echo $row['augustw'] ?></div></div>

<div class="a"><div class="l">September</div><div class="r"><?php echo $row['september'] ?><?php echo $row['septemberw'] ?></div></div>

<div class="a"><div class="l">October</div><div class="r"><?php echo $row['october'] ?><?php echo $row['octoberw'] ?></div></div>

<div class="a"><div class="l">November</div><div class="r"><?php echo $row['november'] ?><?php echo $row['novemberw'] ?></div></div>

<div class="a"><div class="l">December</div><div class="r"><?php echo $row['december'] ?><?php echo $row['december'] ?></div></div>

<div class="a"><div class="l">Total</div><div class="r"><?php echo $row['totald'] ?><?php echo $row['totalw'] ?></div></div>

<div class="a"><div class="l">Current Balance</div><div class="r"><?php echo $row['cb'] ?></div></div>

<div class="a"></div>

</fieldset>

</form>

</div>

</center>

<?php
}
?>

 </BODY>
</HTML>

任何帮助都会受到高度赞赏,因为我甚至不确定是做了什么。

0 个答案:

没有答案