请教大侠,感激不尽!
我首先把我的意图说一下,其实很简单,想实现根据不同的登录名,打开不同的动态表格,我采用了php+mysql+apache的环境,具体代码如下: login.php //登录界面
----------------------------------------------------------
<form action="checkusers.php" method="post">
<table width="276" height="106" border="1">
<tr><td>用户名:</td>
<td>
<input type="text" name="name" id="name" size="15">
</td>
</tr>
<tr><td>密码:</td>
<td>
<input type="password" name="password" id="password" size="15">
</td>
</tr>
<tr><td colspan="2" align="center">
<input type="submit" value="登陆"></td>
</tr>
</table>
</form>
----------------------------------------------------------
checkusers.php //验证
<?php
include("conn.php");
$name=$_POST["name"];
$password=$_POST["password"];
$sql="select * from user where name='$name' and password='$password'";
$rs=mysql_query($sql,$conn);
$i=mysql_num_rows($rs);
if($i>0)//判断结果集中行数,如果行数大于0则说明登陆成功;否则的话,登陆失败
{
echo "<script>alert('登陆成功!欢迎您的归来!');location.href='xls.php'</script>"; //需要跳转到表格页面
}else{
echo "<script>alert('登陆失败!请验证您的用户名或密码是否正确');location.href='login.php';</script>";
}
?>
----------------------------------------------------------
xls.php //输出表格
<?php
$mysql_server_name="localhost";
$mysql_username="root";
$mysql_password="root";
$mysql_database="xls_db";
$conn=mysql_connect($mysql_server_name, $mysql_username,
$mysql_password);
mysql_query("set names 'GBK'");
$strsql="SELECT * FROM `sheet`"; //这里怎么写?
$result=mysql_db_query($mysql_database, $strsql, $conn);
$row=mysql_fetch_row($result);
echo '<font face="verdana">';
echo '<table border="0" cellpadding="1" cellspacing="2">';
echo "\n<tr>\n";
for ($i=0; $i<mysql_num_fields($result); $i++)
{
echo '<td bgcolor="#000F00"><b>'.
mysql_field_name($result, $i);
echo "</b></td>\n";
}
echo "</tr>\n";
mysql_data_seek($result, 0);
while ($row=mysql_fetch_row($result))
{
echo "<tr>\n";
for ($i=0; $i<mysql_num_fields($result); $i++ )
{
echo '<td bgcolor="#00FF00">';
echo "$row[$i]";
echo '</td>';
}
echo "</tr>\n";
}
echo "</table>\n";
echo "</font>";
mysql_free_result($result);
mysql_close();
?>
---------------------------------------------------------------------------
我想引用$name 作为条件:$strsql="SELECT * FROM `sheet` where tell='$name'; 输出不同的表格,可是不知道如何引用,或者其他方式实现,请各位大侠不吝赐教,感谢感谢!!