Forum Moderators: coopster
Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource
Here is the code I am using:
$sql = "UPDATE log SET wTemp = '$thiswTemp' , wSpeed = '$thiswSpeed' , wDirection = '$thiswDirection' , sky = '$thissky' , precipitation = '$thisprecipitation' , pressure = '$thispressure' , moon = '$thismoon' , spot = '$thisspot' , waterName = '$thiswaterName' , waterTemp = '$thiswaterTemp' , city = '$thiscity' , state = '$thisstate' , clarity = '$thisclarity' , bottom = '$thisbottom' , bType = '$thisbType' , bName = '$thisbName' , rig = '$thisrig' , species = '$thisspecies' , length = '$thislength' , weight = '$thisweight' , cTime = '$thiscTime' , cDate = '$thiscDate' , cDepth = '$thiscDepth', notes = '$thisnotes'
WHERE id='$thisid' AND userid='$_SESSION[USERID]' ";
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
echo $sql;
$numberOfRows = mysql_affected_rows($result); This error happens when I inserted the AND userid='$_SESSION[USERID]' in WHERE. In phpmyadmin, if I use my code above, it updates, but it says 0 rows affected. If I take out the userid part, it updates and says 1 rows affected. either way, it updates, but produces a different rows affected.
What I am trying to do is make sure the row being updated is equal to the row id that it is assoc. with and also that the row belongs to the user that is trying to update it.
Any suggestions?
Thanks for any help.
-Mike