samedi 26 avril 2014

How to add a number to a column in PHP and MySQL?


Vote count:

0




If the value is 5 I want to add +1 and the result is 6.



<?php
$db = new PDO ( 'mysql:host=localhost;dbname=database;charset=utf8', 'sunyamacs', 'asd123123');
$db->setAttribute ( PDO::ATTR_ORACLE_NULLS, PDO::NULL_TO_STRING );
$qry = $db->prepare ( "UPDATE user_data SET value = :value" );
$qry->bindParam ( ':value', $db_data ['value'] );
$db_data ['value'] = $db_data ['value'] + 1;
?>


This is not work but how to do it work?



asked 27 secs ago






Aucun commentaire:

Enregistrer un commentaire