Pregunta

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

¿Fue útil?

Solución

That already incremented one; due to Operator Precedence

Parentheses may be used to force precedence, if necessary

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top