The single query for title works, but more than one song with the title exist. so the new query that includes artist doesn’t work. ALthough EXACT search for the song title is correct and works with single query.
what am i doing wrong
//$checkTitle = mysql_query("SELECT * from lyrics WHERE title = '$querytitle'");
$checkTitle = mysql_query("SELECT * FROM lyrics WHERE artist = '$queryArtist' AND title = '$queryTitle'");
$result = mysql_fetch_array($checkTitle);
if (!$checkTitle) {
die('Query Failed');
}
if ($result['title'] == $querytitle) {
?><div id='message'>Song Titled Already Exist <?php echo $cleanTitle; ?> by Artist : <? echo $artist; ?></div><br><br><?
} else {
?><div id="message">Song Titled : <?php echo $cleanTitle; ?> has been added to the database! - <a href="<?php echo $siteURL; ?>artist.php?aid=<?php echo $artist; ?>" target="_Blank">View Artist Page</a></div><br /><br /> <?php echo $queryArtist; ?><?
print_r($result); // the data returned from the query
}
I see you never figured it out from the other question you posted. Try using this query:
Then, if you are expecting only one result, you can use something like this to utilize it: