$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 = '';
  $user = 'root';
  $pass = 'nileshbhanushali';
  $conn = mysql_connect($host, $user, $pass);
  if(! $conn )
   die('Could not connect: ' . mysql_error());
   $sql = "INSERT INTO userinfo ".
   "(email) ".
   "VALUES ".
    $retval = mysql_query( $sql, $conn );
    if(! $retval )
    die('Could not enter data: ' . mysql_error());
     echo "enter succesfully";


but this code select data from localhost database but not insert in to server database?can anybody please give me some suggestion

Recommended Answers

All 7 Replies

plaese help me it's very uregent.....

change your password on your remote server.
Don't post it again!

you forget to select the databaseon the remote, you do on localhost

3e mysql is deprecated. check out MySQLi or PDO_MySQL

password i have already change,and i have also select database in remote you can see at line no 26 but i did not get your 3 point

hey any one can plase answer me?

please buddy help me it's very urgent.....

guyes please please pleasw.......

Member Avatar for diafol

Please stop bumping this thread - 4 times within an hour? That's not cool. The fact that it's urgent is of no concern to us. We all have lives outside Daniweb and contribute when we can.

What don't you understand abut the 3rd point? mysql_* functions are deprecated and you should use mysqli_* functions or PDO.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.