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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.