<?php
$host = "localhost";
$user = "root";
$pass = "";
$databaseName = "foresight";
$tableName = "userinfo";
$con = mysql_connect($host,$user,$pass);
$dbs = mysql_select_db($databaseName, $con);
$result = mysql_query("SELECT * FROM $tableName where flag != 1"); //query
$email = mysql_fetch_row($result);
mysql_close(); //fetch result
?>
<?
$host = '192.232.240.245';
$user = 'root';
$pass = 'nileshbhanushali';
$conn = mysql_connect($host, $user, $pass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
$sql = "INSERT INTO userinfo ".
"(email) ".
"VALUES ".
"('$email')";
mysql_select_db('foresight');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not enter data: ' . mysql_error());
}
else
{
echo "enter succesfully";
}
mysql_close();
?>
but this code select data from localhost database but not insert in to server database?can anybody please give me some suggestion