php - add number values from select option to current value in mysql database? -


i trying find way add selected option value numbers current value in mysql database.

my html code this:

<select name="ratingstars">     <option>select 1 option</option>     <option value="1">very poor</option>     <option value="2">bad</option>     <option value="3">not bad</option>     <option value="4">good</option>     <option value="5">very good</option>     </select> 

my php this:

$ratingstars = $_post['ratingstars'];        if ($stmt = $db_conx->prepare("update registration set total_value = ?  id = ?")){                 $stmt->bind_param('si', $ratingstars, $rated);        $stmt->execute();     $stmt->close();          } 

usual way this:

total_value = total_value + 1 

but need in example shown above?

any appreciated.

thanks

$ratingstars = $_post['ratingstars'];  if ($stmt = $db_conx->prepare("update registration set total_value = total_value + ?  id = ?"))  {     $stmt->bind_param('si', $ratingstars, $rated);        $stmt->execute();     $stmt->close();  } 

you can add new amount old amount in sql statement.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -