I think I'm stuck in a while loop, wondering if someone could spot my error(s):
----------- PHP --------------
$sql = mysql_query("SELECT name FROM newartists");
while ($exisiting = mysql_fetch_array($sql)) {
$exisitingartists = $exisitingartists . $exisiting['name']."\n";
} //endwhile
$exisitingartists = explode("\n", $exisitingartists);
for ($i=0; $i <= count($artist); $i++){
/ Fix up artist name /
$artist[$i] = trim($artist[$i]); // remove whitespace from beginning and end
$artist[$i] = TheEnd($artist[$i]); // add ", The" to end if necessary
$artist[$i] = str_replace(" & ", " and ", $artist[$i]); // replace &'s with and's
$artist[$i] = str_replace("and the", "And The", $artist[$i]);
if (in_array($artist[$i], $exisitingartists)) { // does the artist already exist?
// just update genre
echo "skip: $artist[$i]<br>\n";
} else {
if (in_array($artist[$i].", The", $exisitingartists)) { // how about if we add a ", The" at the end?
// update genre
echo "<i>skip: $artist[$i], The</i><br>\n";
} else {
// insert artist, genre
echo "<b>add: $artist[$i]</b><br>\n";
} //endif
} //endif
} //endfor
echo "$added added, $skipped skipped.";
----------- // PHP -----------
If you need a better look at that, check here: http://www.songmeanings.net/addgenreartists_code.php?source=true
It goes through the array ok, then I get "skipped:" in the browser until I stop it. ;\
Thanks everyone 🙂