Page 1 of 1

Can't use function return value in write context

Posted: Tue Apr 03, 2007 3:01 am
by mevets
I have written a while loop that fetches data from a mysql query. On each iteration of the loop the data is saved to an array if it was not one of the pieces of data marked for deletion. If it was marked for deletion, then that row is deleted from the table.

Code: Select all

$i = 1;
while($row = mysql_fetch_assoc($result)) {
	if (!isset($_POST['btnunarchive'])) {
		if (!isset($_POST['chk' . $i])) {
			$noteinfo[--$i]['note'] = $row['note'];
			$noteinfo[--$i]['author'] = $row['author'];
			$noteinfo[--$i]['time'] = $row['time'];
		}
	}
	elseif (isset($_POST['btnunarchive'])) {
		if (isset($_POST('chk' . $i))) {
			$qunarchive = "DELETE FROM archive WHERE id = $row['id']";
			$uaresult = mysql_query($qunarchive);
			echo 'Note ' . $row['$id'] . 'was deleted.<br />';
		}
	}
	$i++
}
When this code is ran I get
Fatal error: Can't use function return value in write context in /var/www/workspace/notes/archive.php on line 101
Line 101 is

Code: Select all

if (isset($_POST('chk' . $i))) {
What exactly have I done wrong? Also, I am most likely wrong, but in the error message does it mean 'right' as in correct instead of write (just think that'd be a humorous bug)?

Posted: Tue Apr 03, 2007 3:12 am
by mevets
Sorry, figured out that I should be using [] instread of ().

Posted: Tue Apr 03, 2007 10:38 am
by RobertGonzalez
How about editing the original title and add [SOLVED] to the beginning of it?