diff options
author | Paul Arthur <paul.arthur@flowerysong.com> | 2013-04-02 15:41:57 -0400 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2013-04-02 15:44:39 -0400 |
commit | 61b73009089ced10c5eb31801c9dc134234faed4 (patch) | |
tree | 84a54f30c1e11e03889407798d92b793cdd362ae | |
parent | 2a6ac956ed65db4f1868cce51e0231d072bcae18 (diff) | |
download | ampache-61b73009089ced10c5eb31801c9dc134234faed4.tar.gz ampache-61b73009089ced10c5eb31801c9dc134234faed4.tar.bz2 ampache-61b73009089ced10c5eb31801c9dc134234faed4.zip |
GH#4: Tagging artist incorrectly
We should only look up by MBID if we actually have an MBID. Might fix
this issue.
-rw-r--r-- | lib/class/artist.class.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php index b9523ef3..f99ed79b 100644 --- a/lib/class/artist.class.php +++ b/lib/class/artist.class.php @@ -296,14 +296,17 @@ class Artist extends database_object { $exists = false; - $sql = 'SELECT `id` FROM `artist` WHERE `mbid` = ?'; - $db_results = Dba::read($sql, array($mbid)); + if ($mbid) { + $sql = 'SELECT `id` FROM `artist` WHERE `mbid` = ?'; + $db_results = Dba::read($sql, array($mbid)); - if ($row = Dba::fetch_assoc($db_results)) { - $id = $row['id']; - $exists = true; + if ($row = Dba::fetch_assoc($db_results)) { + $id = $row['id']; + $exists = true; + } } - else { + + if (!$exists) { $sql = 'SELECT `id`, `mbid` FROM `artist` WHERE `name` LIKE ?'; $db_results = Dba::read($sql, array($name)); |