赶忙运行一个实例,看看支持mysql不。
<?php
$conn=mysql_connect("localhost","root","");
$db=mysql_select_db("mysql");
$query=mysql_query("select *from username");
echo("<table border=0 width=驌' bgcolor='#CCCCCC' align=center cellspacing=1 cellpadding=0><tr bgcolor='#ffffff' align=center><Td>用户名</td><Td>年龄</td></tr>");
while($row=mysql_fetch_row($query))
{
echo "<tr bgcolor='#FFFFFF' align=center>";
echo "<td>";
echo "<a href='detail.php?id=$row[0]'>" .$row[1]."</a>";
echo "</td>";
echo "<td>";
echo $row[2];
echo "</td>";
echo("</tr>");
}
?>
用户名 | 年龄 |
victor | 23 |
test | 23 |
yan | 23 |
detail.php
<?
//echo $_REQUEST["id"];
$cn=mysql_connect("localhost","root","");
$db=mysql_select_db("mysql");
$query=mysql_query("select *from username where id=".$_GET["id"]);
if($array=mysql_fetch_array($query)){
echo $array[1];
}
else{
echo("居然没有找到记录");
}
?>
没有办法,太过份了。学的这么快,我都有点不好意思了!
Victor.Yan 2007-8-12