I am trying to insert records into my database (basically I'm making a re-named copy of ones that already exist). I'm pulling the records just fine. In fact, if I print my sql statement I can see that there are 15 of them. However, when I go to insert them, only the first one goes in and then it stops and doesn't give any error messages. Both the sql statement and insert statement are inside the loop. What am I missing??
while ($row= @mysql_fetch_array($sqlresult)) {
$ID = $row['ID'];
$maincat = $row['maincat'];
$oldsubcat = $row['subcat'];
$contentweight = $row['contentweight'];
$contentformat = $row['contentformat'];
$oldcontent = $row['content'];
$contenttype = $row['contenttype'];
$aux1 = $row['aux1'];
$creationdate = $row['creationdate'];
// Get rid of pesky ' and " that might cause probs
$content = str_replace("'", "\'", $oldcontent);
$content = str_replace("\"", "\\"", $content);
$newsql = "Insert Into $table_name (maincat, subcat, contenttype, contentweight, contentformat, content, creationdate, aux1) values ('$maincat', '$newtitle', '$contenttype', $contentweight, '$contentformat', '$content', '$daytoday', '$aux1')";
$sqlresult =mysql_query($newsql,$connection) or die("<BR><b>Unable to Insert Records.<BR><BR></b>");
}