<?php
include_once("connect.php");
$query=mysql_query("select * from customer where id=1");
$rs=mysql_fetch_array($query);
$username=$rs['username'];
$userid=$rs['userid'];
$solutation=$rs['solutation'];
$phone=$rs['phone'];
$company=$rs['company'];
$mobile=$rs['mobile'];
$source=$rs['source'];
$sdate=$rs['sdate'];
$job=$rs['job'];
$web=$rs['web'];
$email=$rs['email'];
$createtime=$rs['createtime'];
$modifiedtime=$rs['modifiedtime'];
$note=$rs['note'];
?>显示部分如下
<tr>
<td width="10%" class="edit" id="username"><?php echo $username; ?></td>
<td width="10%" class="edit" id="phone"><?php echo $phone; ?></td>
<td width="10%" class="edit" id="solutation"><?php echo $solutation; ?></td>
<td width="10%" class="edit" id="mobile"><?php echo $mobile; ?></td>
<td width="10%" class="edit" id="email"><?php echo $email; ?></td>
<td width="10%" class="edit" id="job"><?php echo $job; ?></td>
<td width="10%" class="edit" id="source"><?php echo $source; ?></td>
<td width="10%" class="edit" id="company "><?php echo $company; ?></td>
<td width="10%" class="edit" id="createtime"><?php echo $createtime; ?></td>
</tr>
$query=mysql_query("select * from customer where id=1");
上面这个TR是显示在一行的, 我想把它做成N行 并且每一行调用不同的数据库ID (行数)
请问高手帮助应该怎么写··
我对代码不是很熟,可以直接写出来吗··
include_once("connect.php");
$query=mysql_query("select * from customer where id=1");
$rs=mysql_fetch_array($query);
$username=$rs['username'];
$userid=$rs['userid'];
$solutation=$rs['solutation'];
$phone=$rs['phone'];
$company=$rs['company'];
$mobile=$rs['mobile'];
$source=$rs['source'];
$sdate=$rs['sdate'];
$job=$rs['job'];
$web=$rs['web'];
$email=$rs['email'];
$createtime=$rs['createtime'];
$modifiedtime=$rs['modifiedtime'];
$note=$rs['note'];
?>显示部分如下
<tr>
<td width="10%" class="edit" id="username"><?php echo $username; ?></td>
<td width="10%" class="edit" id="phone"><?php echo $phone; ?></td>
<td width="10%" class="edit" id="solutation"><?php echo $solutation; ?></td>
<td width="10%" class="edit" id="mobile"><?php echo $mobile; ?></td>
<td width="10%" class="edit" id="email"><?php echo $email; ?></td>
<td width="10%" class="edit" id="job"><?php echo $job; ?></td>
<td width="10%" class="edit" id="source"><?php echo $source; ?></td>
<td width="10%" class="edit" id="company "><?php echo $company; ?></td>
<td width="10%" class="edit" id="createtime"><?php echo $createtime; ?></td>
</tr>
$query=mysql_query("select * from customer where id=1");
上面这个TR是显示在一行的, 我想把它做成N行 并且每一行调用不同的数据库ID (行数)
请问高手帮助应该怎么写··
我对代码不是很熟,可以直接写出来吗··
...
$query=mysql_query("select * from customer");
while($rs=mysql_fetch_array($query)){
?>
<tr>
<td width="10%" class="edit" id="username"><?php echo $rs['username']; ?></td>
<td width="10%" class="edit" id="phone"><?php echo $rs['phone']; ?></td>
<td width="10%" class="edit" id="solutation"><?php echo $rs['solutation']; ?></td>
<td width="10%" class="edit" id="mobile"><?php echo $rs['mobile']; ?></td>
<td width="10%" class="edit" id="email"><?php echo $rs['email']; ?></td>
<td width="10%" class="edit" id="job"><?php echo $rs['job']; ?></td>
<td width="10%" class="edit" id="source"><?php echo $rs['source']; ?></td>
<td width="10%" class="edit" id="company "><?php echo $rs['company']; ?></td>
<td width="10%" class="edit" id="createtime"><?php echo $rs['createtime']; ?></td>
</tr>
<?php
}
?>
include_once("connect.php");
//举个例子:根据id获取前10条记录
$query=mysql_query("select * from customer order by userid limit 0,10");
while(mysql_fetch_array($query)){
$username=$rs['username'];
$userid=$rs['userid'];
$solutation=$rs['solutation'];
$phone=$rs['phone'];
$company=$rs['company'];
$mobile=$rs['mobile'];
$source=$rs['source'];
$sdate=$rs['sdate'];
$job=$rs['job'];
$web=$rs['web'];
$email=$rs['email'];
$createtime=$rs['createtime'];
$modifiedtime=$rs['modifiedtime'];
$note=$rs['note'];?>
<tr>
<td width="10%" class="edit" id="username"><?php echo $username; ?></td>
<td width="10%" class="edit" id="phone"><?php echo $phone; ?></td>
<td width="10%" class="edit" id="solutation"><?php echo $solutation; ?></td>
<td width="10%" class="edit" id="mobile"><?php echo $mobile; ?></td>
<td width="10%" class="edit" id="email"><?php echo $email; ?></td>
<td width="10%" class="edit" id="job"><?php echo $job; ?></td>
<td width="10%" class="edit" id="source"><?php echo $source; ?></td>
<td width="10%" class="edit" id="company "><?php echo $company; ?></td>
<td width="10%" class="edit" id="createtime"><?php echo $createtime; ?></td>
</tr>
<?php}?>
不好意思哦。。还有一个问题···比如我做两个TR的话 要怎么给他赋予不同的ID呢···
while(你的条件)
{
<tr id="tr<?php echo $i;?>">
<td></td>
<td></td>
</tr>
$i++;
}