Table values transfer one table to another databae table

by mariganesh 2012-12-25 19:32:55

Table values transfer one table to another databae table

Step1 : Edit your hostname,username,password, first and second database name, first and second table name

Step2 : Now run the code


<?php
$hostname = 'localhost';
$username = 'root';
$password = '';
$dbname = 'iptest';
$dbname1 = 'csc';

$conn = mysql_connect($hostname,$username,$password) or die('error connecting to mysql');
mysql_select_db($dbname,$conn);

$qry1="select country from iptables group by country";
$resa=mysql_query($qry1,$conn);
while ($rowat = mysql_fetch_assoc($resa))
{
$name=$rowat['country'];

$insrt="insert into country values('','$name')";
echo $insrt."<br><br>";
$conn1 = mysql_connect($hostname,$username,$password) or die('error connecting to mysql');
mysql_select_db($dbname1,$conn1);
$qrry=mysql_query($insrt,$conn1);
if($qrry)
echo "Successfull!..............<br><br>";
}

?>
957
like
0
dislike
0
mail
flag

You must LOGIN to add comments