1.11M Members

Invalid Argument

 
0
 

I am getting the error message "Invalid argument supplied for foreach()". I can't see to figure out what. Below is my query. Is there something I'm missing? Thanks

public function editRole($id) {
        $q = $this->_db->query("SELECT * FROM `" . TP . "roles` WHERE `ID` = '" . floatval($id) . "' LIMIT 1");
        while($r = $q->fetch_array()) {
            $id = $r[0];
        }
        return $id;
    }
 
0
 

Are you sure you are showing the right snippet? If it is the while then the query must have failed. Add some debugging.

Question Answered as of 1 Year Ago by pritaeas
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: