prob with strpos
Posted: Sat Feb 01, 2003 7:27 pm
i have this bit of code
the bit giving me problems is
i want to break out and not display output if the first letter of the variable starts with a certain letter, its like a filter out and only show names with a-g on the page $bchar is passed by the url so if you had bchar=b it would filter out all entries that come after b, right now it is just completely stoping all entries from showing regardless of what $bchar is equal to
Code: Select all
while ($data = fetcho_query($query)) {
// Break out if it begins with split letter
if (strpos($bchar, $dataї'name']) == 0) break;
// Make overall rating
$rating = round(($dataї'rating_animation'] + $dataї'rating_characters'] + $dataї'rating_music'] + $dataї'rating_plot'] + $dataї'rating_sound'] + $dataї'rating_voiceacting']) / 6, 1);
$date = date("n/j/Y", $dataї'revid']);
$search = array('<LISTBIT: Name>', '<LISTBIT: Genre>', '<LISTBIT: Type>', '<LISTBIT: Date>', '<LISTBIT: Rating>', '<LISTBIT: ID>');
$replace = array($dataї'name'], $dataї'genre'], $dataї'type'], $date, $rating, $dataї'revid']);
$list_reviews .= str_replace($search, $replace, stripslashes($keybaseї'review_listbit']));
}Code: Select all
if (strpos($bchar, $dataї'name']) == 0) break;