Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7636015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:34:08+00:00 2026-05-31T07:34:08+00:00

I am trying to take data from one mysql table and insert it in

  • 0

I am trying to take data from one mysql table and insert it in to another so i can make some updates without using a live db table. The problem i am having is it is taking the data out of the first table but not inserting it in the second. Any help would be appreciated.

 error_reporting(E_ALL);
 ini_set("display_errors", 1); 

 $host="";
 $username="";
 $password="";
 $database="";

 mysql_connect($host,$username,$password);
 @mysql_select_db($database) or die( "Unable to select database");

 $query = "SELECT * FROM livetrack where member_id ='000826'";   
 $result = mysql_query($query) or die(mysql_error());
 while($row = mysql_fetch_array($result)){
 $ipa = $row['ip_address'];
 $date = $row['date'];
 $referer = $row['referer'];
 $string = $row['string'];
 $member_id = $row['member_id'];
 echo "Insert Data.....";
 mysql_query("INSERT INTO livetrack11 (ip_address, date, referer, string, member_id)
         VALUES ('$ipa', '$date', '$referer', '$string', '$member_id'");

 }

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:34:09+00:00Added an answer on May 31, 2026 at 7:34 am

    Just use a simgle insert-select statement:

    insert into livetrack11 (ip_address, date, referer, string, member_id)
    select ip_address, date, referer, string, member_id
    from livetrack
    where member_id ='000826';
    

    Leave off the where to simply copy the whole table.

    Even easier to copy the table:

    create table livetrack11 as select * from livetrack;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the entity framework to take data (nested relationships) from one
I am trying to take a data string from one column and split it
I'm trying to use Squeryl to take the contents of a table from one
so i'm trying to do a data migration where i take the listings from
Has anyone used jquery to take data from one form field and put it
Has anyone used javascript/ajax to take data from one form field and put it
I'm at a lose with this one. Trying to take edittext from a list
I am trying to do some simple statistics on data I am pulling from
I am trying to take tables from one Access Database File, add them to
I'm trying to connect to a mysql db, but from another server and process

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.