Welcome Guest, Not a member yet? Register   Sign In
Message: Missing argument 1 for, and Error Number: 1064, can't figure out why I'm getting these...
#1

[eluser]Unknown[/eluser]
Hi there, I can't figure out why I'm getting these errors.

I'm passing from my URI->controller->model. However, even though I KNOW I'm getting the variable to the model (it's being echoed during my troubleshooting). I get those errors.
Any help would be greatly appreciated.

URL: http://development.mange.biz/properties/...ax/min/max

Show properties controller:
Code:
$province = ((string)$this->uri->segment(3, 'All'));
            $city = ((string)$this->uri->segment(4, 'All'));
            $minSize = ((string)$this->uri->segment(5, 'min'));
            $maxSize = ((string)$this->uri->segment(6, 'max'));
            $minPrice = ((string)$this->uri->segment(7, 'min'));
            $maxPrice = ((string)$this->uri->segment(8, 'max'));

$this->properties_model->getNumberProperties($province, $city, $minSize, $maxSize, $minPrice, $maxPrice);

Model:
Code:
function getNumberProperties($province, $city, $minSize, $maxSize, $minPrice, $maxPrice)
        {
        if ($province === "All"){echo 'entered 1';}
        else{
            echo $province;
            $this->db->where('province', $province);
            }
        if ($city === "All"){echo 'entered 2';}
        else{
            $this->db->where('city_id', $city);
        }
        if ($minSize === "min"){echo 'entered 3';}
        else{
            $this->db->where('size > ', $minSize);
        }
        if ($maxSize === "max"){echo 'entered 4';}
        else{
            $this->db->where('size < ', $maxSize);
        }
        if ($minPrice === "min"){echo 'entered 5';}
        else{
            $this->db->where('price > ', $minPrice);
        }
        if ($maxPrice === "max"){echo 'entered 6';}
        else{
            $this->db->where('price < ', $maxPrice);
        }
        
        $query = $this->db->count_all_results('properties');
        if (!$query > 0) {
            die("There are no rows.");
        }
        else{
            return $query;
    
        }

    }

Quote:The error its generating is
A PHP Error was encountered

Severity: Warning

Message: Missing argument 1 for Properties_model::getNumberProperties(), called in /home/edster/public_html/development/application/controllers/properties.php on line 58 and defined

Filename: models/properties_model.php

Line Number: 47

A PHP Error was encountered

Severity: Warning

Message: Missing argument 2 for Properties_model::getNumberProperties(), called in /home/edster/public_html/development/application/controllers/properties.php on line 58 and defined

Filename: models/properties_model.php

Line Number: 47

A PHP Error was encountered

Severity: Warning

Message: Missing argument 3 for Properties_model::getNumberProperties(), called in /home/edster/public_html/development/application/controllers/properties.php on line 58 and defined

Filename: models/properties_model.php

Line Number: 47

And

Quote:A Database Error Occurred
Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND `size` < AND `price` > AND `price` <' at line 6

SELECT COUNT(*) AS `numrows` FROM (`properties`) WHERE `province` IS NULL AND `city_id` IS NULL AND `size` > AND `size` < AND `price` > AND `price` <

Filename: /home/edster/public_html/development/models/properties_model.php

Line Number: 75




Theme © iAndrew 2016 - Forum software by © MyBB