my $users_sth = $dbh->prepare(qq{ INSERT IGNORE INTO `wp_users` (`user_login` , `user_pass` , `user_nicename` , `user_email` , `user_registered` , `user_status` , `display_name` ) VALUES (?, $random_password, ?, 'no-email\@localhost', ?, 0, ?)}); $users_sth->execute($authors[$i], $authors[$i], $now, $authors[$i]); my $author_sth = $dbh->prepare(qq{SELECT id from wp_users WHERE user_login=?}); my $post_author = $authors[$i]; $author_sth->execute($authors[$i]); $author_sth->bind_col(1, \$post_author); my @output = fetch_body($urls[$i]); while ($author_sth->fetch) { my $post_sth = $dbh->prepare(qq{ INSERT IGNORE INTO `wp_posts` (`post_author` , `post_date` , `post_content` , `post_title`) VALUES (?, ?, ?, ?)}); $post_sth->execute($post_author, $now, @output, $titles[$i]); } }; #### ALTER TABLE `wp_posts` ADD UNIQUE (`post_title`); #### | 597 | 102 | New Home Builders in Houston | 595 | 102 | New Home Builders In Houston Texas ... | 772 | 136 | Buy to Let Rental Properties | 754 | 136 | Buy to Let Rental Property