I'm trying to get it so that when a verse exists after the one being shown, it gives a link to view it and when the verse does not exist, it displays "end" or "start". I thought that I could do this by making a mysql query and seeing if it returned with a value. Somehow, it's not working. In the database, the field doesn't exist yet it's still returning as a value.
$previous_sql = @mysql_query("SELECT bible_text FROM ptv3_bible_ot WHERE bible_book = '$book' AND bible_chap = '$jump_chap' AND bible_verse = '$verse_minus'");
if(!$previous_sql) {
echo("<span class='smtextblk'>start</span>");
} else {
echo("<a href='" . $PHP_SELF . "?bible_action=" . $bible_action . "&view=" . $view . "&book=" . $book . "&jump_chap=" . $jump_chap . "&jump_verse=" . $verse_minus . "' class='bible_link'>previous</a>");
}
Can anyone see anything wrong with this?
Code:
$previous_sql = @mysql_query("SELECT bible_text FROM ptv3_bible_ot WHERE bible_book = '$book' AND bible_chap = '$jump_chap' AND bible_verse = '$verse_minus'");
if(!$previous_sql) {
echo("<span class='smtextblk'>start</span>");
} else {
echo("<a href='" . $PHP_SELF . "?bible_action=" . $bible_action . "&view=" . $view . "&book=" . $book . "&jump_chap=" . $jump_chap . "&jump_verse=" . $verse_minus . "' class='bible_link'>previous</a>");
}
Can anyone see anything wrong with this?