Skip to content

Commit

Permalink
Fix output of stars as float values.
Browse files Browse the repository at this point in the history
Outputting float values from PHP is locale dependant and may use commas as the decimal separator. This works inside PHP, but not when generating SQL, because dots are the only valid decimal separators there.

Signed-off-by: Karl Dietz <[email protected]>
  • Loading branch information
yunosh authored and dekarl committed Jan 13, 2017
1 parent e902c97 commit aa5d4f3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/tv/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@
if (in_array('movie', $_SESSION['search']['ctype'])) {
if (count($_SESSION['search']['ctype']) > 1) {
$extra_query[] = 'IF(program.category_type = "movie",'
.' program.stars >= '.$_SESSION['search']['stars_gt']
.' AND program.stars <= '.$_SESSION['search']['stars_lt']
.' program.stars >= '.number_format($_SESSION['search']['stars_gt'], 2, '.', '')
.' AND program.stars <= '.number_format($_SESSION['search']['stars_lt'], 2, '.', '')
.', 1)';
}
else {
$extra_query[] = ' program.stars >= '.$_SESSION['search']['stars_gt']
.' AND program.stars <= '.$_SESSION['search']['stars_lt'];
$extra_query[] = ' program.stars >= '.number_format($_SESSION['search']['stars_gt'], 2, '.', '')
.' AND program.stars <= '.number_format($_SESSION['search']['stars_lt'], 2, '.', '');
}
}
// Date range
Expand Down

0 comments on commit aa5d4f3

Please sign in to comment.