0

I'm trying to increase the value in the table by one but I don't really know mysql and I don't know whats wrong. It seems to go through no problem but when I check the database the number hasn't changed. Thanks in advance! :)

    $con = mysqli_connect($db_host, $db_user, $db_pass, $db_name);

if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
} else {
    echo "it works!";
}

switch ($_POST['found']) {
    case "facebook":
        mysqli_query($con,"UPDATE `found` SET `number` = 'number + 1' WHERE `id` = 'Facebook'");


        break;
Shadow
  • 33,525
  • 10
  • 51
  • 64
james
  • 101
  • 1
  • 8

1 Answers1

1

Try this:

 case "facebook":
    mysqli_query($con,"UPDATE `found` SET number = number + 1 WHERE `id` = 'Facebook'") or die(mysqli_error($con));

Hope this helps.

Indrasis Datta
  • 8,692
  • 2
  • 14
  • 32