<?php
header('Content-Type:text ml;charset=utf-8');
$link = mysql_connect('localhost','root','usbw');
mysql_select_db('itcast',$link);
mysql_query('set names utf8');
$sql = "select * from book_list";
$result = mysql_query($sql,$link);
while($row = mysql_fetch_array($result))
{
echo "<table border='1' cellspacing='1' align='CENTER' width='900'>";
echo "<tr height='50' bgcolor= ' #ccc' >";
echo "<td width='210' align='center' bgcolor= ' #aaa'>".$row[0]."</td>";
echo "<td width='450' align='center' >".$row[1]."</td>";
echo "<td width='210' align='center' >".$row[2]."</td>";
echo "<td width='210' align='center' >".$row[3]."</td>";
echo "<td width='450' align='center' bgcolor= ' #aaa'>".$row[4]."</td>";
echo '</tr>';
echo "<tr height='50' bgcolor= ' #ccc' >";
echo "<td width='210' align='center' bgcolor= ' #aaa'>".$row[0]."</td>";
echo "<td width='450' align='center' >".$row[1]."</td>";
echo "<td width='210' align='center' >".$row[2]."</td>";
echo "<td width='210' align='center' >".$row[3]."</td>";
echo "<td width='450' align='center' bgcolor= ' #aaa'>".$row[4]."</td>";
echo '</tr>';
echo "</table>";
}
?>
php连接数据库的相关操作
最新推荐文章于 2024-08-13 14:54:57 发布