I have a script that demands a bit of filtering from an sql database.
Code: Select all
$GBookID = $HTTP_GET_VARSї'GBookID'];
$GChapterID = $HTTP_GET_VARSї'GChapterID'];
$LetterID = $HTTP_GET_VARSї'LetterID'];
mysql_select_db($database_lexicon, $lexicon);
$query_Characters = "SELECT * FROM `character` WHERE CNameL like '$LetterID%' AND (BookID < '$GBookID') OR (BookID = '$GBookID' AND ChapterID <= '$GChapterID') ORDER BY `CNameL` ASC";
$Characters = mysql_query($query_Characters, $lexicon) or die(mysql_error());
$row_Characters = mysql_fetch_assoc($Characters);
$totalRows_Characters = mysql_num_rows($Characters);The problem occurs when I combine them. For some reason when GBookID = 3, everything works perfectly with the LetterID and GBookID and GChapterID. But when GBookID = anything else, The results that appear are incorrect. Random entries, starting with any letter not just the one specified in LetterID, appear.
I hope I am making since. Does anyone have an Idea as to what is causing this? or what I could do to fix it?