日期:2014-05-17 浏览次数:20463 次
<?php $conn=new com("adodb.connection"); $connstr="Driver={Microsoft Excel Driver (*.xls)};DBQ=".realpath("excel/book.xls"); $conn->open($connstr); $sql="select top 11 * from [Sheet1$]"; $rs=$conn->execute($sql); if($rs->eof || $rs->bof) { echo "<div align=center>暂无图书信息!</div>"; } else { while(!$rs->eof) { ?> <tr> <td height="25" align="center" bgcolor="#FFFFFF"><?php $fields=$rs->fields(number);echo $fields->value;?></td> <td height="25" align="center" bgcolor="#FFFFFF"><?php $fields=$rs->fields(title);echo $fields->value;?></td> <td height="25" align="center" bgcolor="#FFFFFF"><?php $fields=$rs->fields(datetime);echo $fields->value;?></td> <td height="25" align="center" bgcolor="#FFFFFF"><?php $fields=$rs->fields(sale);echo $fields->value;?></td> <td height="25" align="center" bgcolor="#FFFFFF"></td> </tr> <?php $rs->movenext; } } ?>