Question

this my code:

$stmt->prepare("UPDATE ".$PapierTableName."  SET nrating=nrating+1,`rating`=(rating+?)/nrating  WHERE `id`=? AND `title`=?");
$stmt->bind_param('iis', $rat,$id,$tit);

My question is about the priority: in this operation

`rating`=(rating+?)/nrating

the nrating that will be used is the one already incremented or the one that is present in column?
Thanks

Was it helpful?

Solution

That already incremented one; due to Operator Precedence

Parentheses may be used to force precedence, if necessary

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top