Jump to content

newb: table merge issues


doofy

Recommended Posts

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

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.