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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.