library 显示所有的数据
<?php
$conn = @mysql_connect('localhost', 'root', '');
if($conn) {
echo "连接成功";
}else {
echo "连接失败";
}
@mysql_query("set names 'utf8'");
echo '<br >';
$flag = @mysql_select_db("library", $conn);
if($flag) {
echo "找到了";
}else {
echo "没找到";
}
echo '<br />';
$sql="select * from book";
$result = mysql_query($sql, $conn);
while($row=mysql_fetch_array($result)) {
echo '<td>'.$row['bid'].'</td><br />';
echo '<td>'.$row['bname'].'</td><br />';
echo '<td>'.$row['price'].'</td><br />';
echo '<td>'.$row['bnum'].'</td><br />';
}
?>