I only want to copy one value from the first table to the 2nd, where the ID's are the same in each. The 2nd table is dependant on the first table, so these will always match and there can be multiple matches at the 2nd table.
Here's what I'm trying - it doesn't give me any errors, but also doesn't work.
<?php $unique_ID="SELECT message FROM mail_attachments"; mysql_query($unique_ID) or die(mysql_error()); $query="INSERT INTO mail_attachments (username) SELECT mail_to_name FROM mailbox WHERE mailID='$unique_ID'"; mysql_query($query) or die(mysql_error()); ?>
The "message" field from "mail_attachments" is not auto_incremented, it is the same number as "mailID" in "mailbox".
I also tried writing it out like an example I found on the mysql page
...FROM mailbox WHERE mailbox.mail_to_name = mail_attachments.message;But I got so many errors from this it didn't seem like something I could do in PHP.