Re: html,mysql,php copy data from one db to another
i have considered replication and it will not work for what i need. i do like the insert ... update on duplicate key. i will modify my code to use it and see where it gets me.
Ok so now i have modified my code a little. I have found something that may be why things aren't right. I noticed that on my very first echo statement inside the php delimeters, something is screwy:
My Code (incomplete btw):
mysql_select_db("JTDMirror", $con);
$fields_num = mysql_num_fields($MainResult);
$MirrorResult = mysql_query("SELECT * FROM JTD");
echo "<table border='1'><tr>"; <-----------------------right here
// printing table headers
for($i=0; $i<=$fields_num; $i++)
{
$field = mysql_fetch_field($MirrorResult);
echo "<td>{$field->name}</td>";
}
echo "</tr>\n";
// printing table rows
while($row = mysql_fetch_row($MirrorResult))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
echo "<td>$cell</td>";
echo "</tr>\n";
}
echo "</table>";
mysql_free_result($MainResult);
mysql_free_result($MirrorResult);
My results in web browser:
"; // printing table headers for($i=0; $i<=$fields_num; $i++) { $field = mysql_fetch_field($MirrorResult); echo "{$field->name}"; } echo "\n"; // printing table rows while($row = mysql_fetch_row($MirrorResult)) { echo ""; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "$cell"; echo "\n"; } echo ""; mysql_free_result($MainResult); mysql_free_result($MirrorResult); mysql_close($con); ?>
What i see when i 'Inspect Element' in said browser:
... other code
$MirrorResult = mysql_query("SELECT * FROM JTD");
echo "<table border='1'--> <------------------------------right here
"";// printing table headers
for($i=0; $i<=$fields_num; $i++)
{
... other code
All my other code looks right but for some reason this changes, the remainder of my code is output except whats in between the "" in other echo statements and i dont know why.
Subject
Written By
Posted
Re: html,mysql,php copy data from one db to another
June 04, 2012 11:08AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.