<?php
$db = "test";
$table1 = "1character";
$table2 = "2character";
$column = "resets";

$link = mysql_connect("localhost","user","pass") or die("Couldn't connect to MySQL");

mysql_select_db($db , $link) or die("Couldn't open $db");

$result = mysql_query("SELECT $column FROM $table1") or die("SELECT Error");

while($row = mysql_fetch_array($result)) {
	$str = $row[$column];
	mysql_query ("INSERT INTO $table2 ($column) VALUES ('$str')");
}
mysql_close($link);
?>
Published in: MySQL
Download

Related snippets