Why am I getting the following error in my code?
Fatal error: Can't use function return value in write context in....
I I had return statements inside the if...else when i first started working on this function, and the error seems like one that has to do with return statements. but i replaced them with echo statement's and I'm still getting the error's so I have no clue what's going on. Any help or advise?
public function wallPostComments() {
// This function processes wall post comments
// pull the submitted comment data
$returnedPostId = $this->inuput->post('entryId');
$returnedCommentData = $this->input->post('returnedCommentData');
// pull the required session data
$userid = $this->session->userdata('userid');
// select the sql data from wallPosts and wallPostComments
$query = $this->db->query("SELECT * FROM wallPosts, wallPostComments");
// loop through the mysql rows and process the expanded sql code
foreach ($query->result() as row()) {
if($row->idwallPosts == $JSONedIdWallPosts) {
echo "success";
} else {
echo "failure";
}
}
}
Answer
When did row()
become a function?
Try:
foreach ($query->result() as $row) {
No comments:
Post a Comment