how to add values in mysql table code example

Example 1: mySql insert row

INSERT INTO `table_name`(column_1,column_2,...) VALUES (value_1,value_2,...);

Example 2: sql insert into

INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);

Example 3: mysql add to value

<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);

mysql_query("UPDATE `some_table` SET `value` = `value` + 1000 WHERE `id` = 1");

mysql_close($con);
?>

Example 4: mysql add to value

UPDATE addingValueToExisting SET GameScore = GameScore+10 WHERE Id = 4;

Tags:

Sql Example