PDA

View Full Version : Can't use mysqli_num_rows value in a write context


songboy
03-11-2011, 12:08 AM
I am trying to cut down the number of almost duplicate scripts with respect to an upload operation. Success hinges on my being able to use the returned value from a mysqli_num_rows result:
$numsongs = mysqli_num_rows($result1);
Currently, I'm using loads of if conditions to match the result with various numbers that $numsongs might be (1 to 5). Depending on the result, we move on to one of 5 form pages. I could cut this down to one page if I can get to use the $numsongs value. But no matter what I do, I get this warning: 'Can't use function return value in write context.'
How can you use the value of a mysqli_num_rows result in a write context ? I want to use the value as a variable elsewhere and it seems odd that if the value is say, 4, that you can't just declare this as a variable and use it as such.
I would be grateful for the answer to this one.
Thanks-
Songboy

johnMoss
03-11-2011, 04:31 AM
http://stackoverflow.com/questions/3888376/cant-use-function-return-value-in-write-context-error-in-php

Couldn't tell if it would help or not, but maybe worth a look...