Jump to content

[SOLVED] Transfer array of data from 1 mysql table to another (PHP)


DamienRoche

Recommended Posts

I'm having trouble inserting the exact array of data from one mysql table into another.

 

so say I have two columns and 3 rows:

name   || email

-----------------

name1  || email1

name2  || email2

name3  || email3

______________

 

How do I transfer that exact data from one table to another using php?

 

Thanks.

Well you can loop it, or you can do it all at once,

I would start with getting the rows into arrays

$string = 'select col1 col2 from tbl_name'
$query = mysql_query($string);
$row = 1; //or number of first row
$col= 1; //or whatever colum number is name
$get = mysql_result($query, $row, $col);
$string2 = "select * from  tbl_name where name='$get'";
$array1 mysql_fetch_arrar();
$string3 = "insert into tbl_name(name, email) values('$array1[0]', '$array[1]')";
$query2 = mysql_query($string3);

 

That might work.. just as a brain stormer at least.

vbnullchar apparently has a much easier way though lol

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.