doofy Posted November 19, 2011 Share Posted November 19, 2011 Hi there, I'm new to this (2 days into it) but I've managed to rummage together 2 tables, and PHP to input into the database. My issue now is that I want to merge one of the two tables into the other. I've managed to do this, but for some reason I'm getting duplicate entries from the 2nd table. Code: //mysql connection $query = "SELECT ArticleDescription, URL FROM top_web_articles"or die ("query is messed up"); $result = mysql_query($query); while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { mysql_query("INSERT INTO web_articles (ArticleDescription, URL) SELECT ArticleDescription, URL FROM top_web_articles") or die ("Failed merge!"); } echo ("Successful merge!"); ?> Does anyone have any suggestions as to where I went wrong? Thanks in advance, Doofy. Link to comment https://forums.phpfreaks.com/topic/251421-newb-table-merge-issues/ Share on other sites More sharing options...
doofy Posted November 19, 2011 Author Share Posted November 19, 2011 I removed the broken while loop, and added SELECT UNIQUE. Problem solved, please close. Cheers, Doofy Link to comment https://forums.phpfreaks.com/topic/251421-newb-table-merge-issues/#findComment-1289572 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.