Jump to content

how to copy data from other database using php


don11

Recommended Posts

Hello,

I need help. I want to know how to copy a field value of a table from one database to other database using php.

I have a field name "invites" in a table "members" in database "db1" and a field name "new_invites" in a table "new_members" in database "db2".

I want to copy value of field "invites" to "new_invites". How to do that?

you hav't assigned anything to $result

$result = mysql_query($query,$which) or die ('Error performing database lookup -- '.mysql_error());

Now that gets you a value attached to $result,  However, this isn't your actual data from your database.  Next you need to call the data into an array, and as you next to never have a single row of data in a table, you will need to run through each row by using a while loop.  Once you have the information into the array, you can then pull it out into a flat variable such as $kk.  Look up some examples online on how to use mysql_fetch_assoc(), or better still get a book on php and mysql from amazon or somewhere, it will make a much more convenient refference.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.