0

hi all im attempting to update coryApp script and im getting the following error

PHP Warning: Division by zero

can anyone help on this please be much appreicated heres is where the error is coming from

if(isset($error) && !empty($error))
            echo '<p style="margin:0px; padding:5px 20px"><font color="#FF0000"><small><i>'.$error.'</i></small></font></p>';
        $config['showeachside'] = 4;
        $config['per_page'] = 20;
        $config['js_numrows_page'] = mysqli_num_rows(getListState($str, ''));
        $config['curpage'] = empty($_GET['p'])?1:$_GET['p'];
        $config['rs_start'] = ($config['curpage']*$config['per_page'])-$config['per_page'];
        if($config['js_numrows_page'] < $config['per_page'])
            $config['per_page'] = $config['js_numrows_page'];
        $page = (isset($_GET['p']) && intval($_GET['p'])>0)?'&p='.$_GET['p']:'';
        $config['cururl'] = $base_url.'admincp/states.php'.$pstr;
        $rs_maxpage = ceil($config['js_numrows_page']/$config['per_page']);
        $paging = Pagination($config);
        $list = getListState($str, " limit ".$config['rs_start'].", ".$config['per_page']);
        if(mysqli_num_rows($list)>0){

and here is the function for it

if(!function_exists('getListState')){
    function getListState($str='', $limit=''){
        global $conn;
        $sql = "SELECT StateID as Id, State as L1Value, s.CountryID as L3Value, Country as L4Value from ".$GLOBALS['table_prefix']."states as s inner join ".$GLOBALS['table_prefix']."countries as c on c.CountryID = s.CountryID ".$str." order by StateID desc ".$limit;
        $query = mysqli_query($conn,$sql);
        if(!$query)
            return '';
        else return $query;
        }
    }
2
Contributors
3
Replies
13
Views
2 Months
Discussion Span
Last Post by jstfsklh211
0

okies would i have to change this

from

if(mysqli_num_rows($list)>0){

to

if(mysqli_num_rows($list)>100){

as i have read in google but still brings same error

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.