Php 在另一个表中动态打印表记录
我动态检索用户名记录并打印到一个表中,现在我想将所有这些记录打印到另一个表中,该表具有不同的字段,如Php 在另一个表中动态打印表记录,php,mysql,Php,Mysql,我动态检索用户名记录并打印到一个表中,现在我想将所有这些记录打印到另一个表中,该表具有不同的字段,如 table users: 1. 2. 3. 4. 5. 6. 我使用提交按钮将所有记录动态地放入表中 <?php $username=$_POST['u_name']; echo $username; $link = mysql_connect("localhost","root","") or die("Could not connect now"); mysql_
table users:
1.
2.
3.
4.
5.
6.
我使用提交按钮将所有记录动态地放入表中
<?php
$username=$_POST['u_name'];
echo $username;
$link = mysql_connect("localhost","root","") or die("Could not connect now");
mysql_select_db("wp_trainee_management") or die("Database not found");
//$image_caption = $_POST['image_caption'];
//$image_username = $_POST['attendance'];
//$u_name = $_POST['u_name'];
$today = date("Y-m-d");
$insert = "insert into attendance (attendance_date,name,presents)
values ('$today','".$username."','yes')";
$insertresults = mysql_query($insert) or die(mysql_error());
?>
您可以使用foreach函数将每条记录插入另一个表中
foreach($insertdata->result() as $user)
{
$this->db->insert('attendance',array($user->attendance_date,$user->name,$user->presents));
}
哪一张是第二张桌子?详细说明更多plz