Welcome Guest, Not a member yet? Register   Sign In
Query was working then just stopped
#1

[eluser]Unknown[/eluser]
Hello all,
I am new to CodeIgniter and really need some help. In my Model I have a query that is now just not working. I have no idea why..
Here is the error:
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 '12,311,8,64 Group By am_app_id Having count(*)= 4' at line 1

SELECT am_app_id FROM vendor_app_features Where am_feature_id in 12,311,8,64 Group By am_app_id Having count(*)= 4

Filename: /var/www/edjmatrix.com/htdocs/matrix/models/app_features_model.php

Line Number: 64


Here is the actual code:
Code:
function getAllAppsByFeatureId($featuresArrayOld) {
  foreach ($featuresArrayOld as $feature) {
            $feature = explode("_", $feature);
            $featuresArray[] = $feature[0];

        }
    
        $totalFeatures = sizeof($featuresArray);
        $featureArray = implode(",", $featuresArray);

$query = $this->db->query("SELECT am_app_id FROM vendor_app_features Where am_feature_id in ($featureArray) Group By am_app_id Having count(*)= $totalFeatures");

        $vendor_app_List = array();

        if ($query->num_rows > 0) {
            foreach ($query->result() as $row) {
                $vendor_app_List[] = $row->am_app_id;
            }
            return $vendor_app_List;
        }
  
    }

Can you see anything wrong with this? What can I change?
Up until 11:00 today it was working just fine.
I inhearted this site and I am trying to learn this MVC as fast as I can.

-J



Messages In This Thread
Query was working then just stopped - by El Forum - 05-29-2012, 06:22 PM
Query was working then just stopped - by El Forum - 05-29-2012, 06:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB