1,105,578 Community Members

Invalid Argument

Member Avatar
joshmac
Junior Poster
119 posts since Apr 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 5 [?]
Skill Endorsements: 0 [?]
 
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;
    }
Member Avatar
pritaeas
mod_pritaeas
11,315 posts since Jul 2006
Reputation Points: 1,420 [?]
Q&As Helped to Solve: 1,835 [?]
Skill Endorsements: 156 [?]
Moderator
Featured
Sponsor
 
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: