这是我的代码
echo '<input type="submit" name="submit">';
我使用此查询从另一个表中获取数据
if($_POST['submit'])
{
$sql = mysql_query('SELECT q.username, q.firstanme,q.lastname FROM quizgroup q');
foreach($sql as $s)
{
$username = $s->username;
$firstname = $s->firstname;
$lastname = $s->lastname;
$sql = mysql_query('INSERT INTO user(username,firstname,lastname) VALUES('.$username.','.$first.','.$last.')');
}
}
答案 0 :(得分:2)
试试这个
insert into user (SELECT username, firstanme, lastname FROM quizgroup)
此语句将数据从测验组复制到用户表
复制数据时不要使用“values”关键字
看看这个