Ive been messing with it and now have it to the point were nothing is displayed on the screen. i noticed that when i changed how the ' and " were in all the echo statments and changed the echo statements to only either "text" or $variables, it slowly began printing to the screen from lower and lower in the code from where i made the modifications. now it prints nothing, and apparently does nothing. i see no changes to my db and no table is on the screen
<html>
<body>
<?php
//Part 1: get data to copy
$con = mysql_connect("IPADDRESS","USERNAME","PASSWORD");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("DATABASE", $con);
$MainResult = mysql_query("SELECT column1
,column2
,column3
,column4
,column5
,column6
,column7
,column8
,column9
,column10
,column11
,column12
,column13
,column14
,column15
,column16
,column17
FROM TABLE");
mysql_close($con);
// Done with part 1: get data to copy
//Part 2: Insert and Update with new data
$con = mysql_connect("IPADDRESS","USERNAME","PASSWORD");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("DATABASE", $con);
while ($row = mysql_fetch_row($MainResult))
{
mysql_query("INSERT INTO TABLE VALUES ('$row[0],
$row[1],
$row[2],
$row[3],
$row[4],
$row[5],
$row[6],
$row[7],
$row[8],
$row[9],
$row[10],
$row[11],
$row[12],
$row[13],
$row[14],
$row[15],
$row[16],
NULL')
ON DUPLICATE KEY UPDATE TABLE SET COLUMN1=$row[0],
COLUMN2=$row[1],
COLUMN3=$row[2],
COLUMN4=$row[3],
COLUMN5=$row[4],
COLUMN6=$row[5],
COLUMN7=$row[6],
COLUMN8=$row[7],
COLUMN9=$row[8],
COLUMN10=$row[9],
COLUMN11=$row[10],
COLUMN12=$row[11],
COLUMN13=$row[12],
COLUMN14=$row[13],
COLUMN15=$row[14],
COLUMN16=$row[15],
COLUMN17=$row[16];")
}
//Done with part 2: Insert and Update with new data
//Part 3: Print Data from Updated DB
$MirrorResult = mysql_query("SELECT * FROM TABLE");
$fields_num = mysql_num_fields($MirrorResult);
echo '<table border="1"><tr>';
$fields = mysql_query("DESCRIBE TABLE;");
while ($row = mysql_fetch_row($fields))
{
echo "<th>";
echo $row[0];
echo "</th>";
}
echo "</tr>";
while($row = mysql_fetch_row($MirrorResult))
{
echo "<tr>";
echo "<td>";
echo $row[0];
echo "</td>";
echo "<td>";
echo $row[1];
echo "</td>";
echo "<td>";
echo $row[2];
echo "</td>";
echo "<td>";
echo $row[3];
echo "</td>";
echo "<td>";
echo $row[4];
echo "</td>";
echo "<td>";
echo $row[5];
echo "</td>";
echo "<td>";
echo $row[6];
echo "</td>";
echo "<td>";
echo $row[7];
echo "</td>";
echo "<td>";
echo $row[8];
echo "</td>";
echo "<td>";
echo $row[9];
echo "</td>";
echo "<td>";
echo $row[10];
echo "</td>";
echo "<td>";
echo $row[11];
echo "</td>";
echo "<td>";
echo $row[12];
echo "</td>";
echo "<td>";
echo $row[13];
echo "</td>";
echo "<td>";
echo $row[14];
echo "</td>";
echo "<td>";
echo $row[15];
echo "</td>";
echo "<td>";
echo $row[16];
echo "</td>";
echo "<td>";
echo $row[17];
echo "</td>";
echo "</tr>\n";
}
echo "</table>";
mysql_free_result($MainResult);
mysql_free_result($MirrorResult);
mysql_close($con);
//Done with part 3: Print Data from Updated DB
?>
</body>
</html>