 <p>First of all - in your sql you have:</p> <pre><code>`product_id` = '1' </code></pre> <p>do not use id value as a string:</p> <pre><code>`product_id` = 1 </code></pre> <p>About your problem:</p> <p>Add another condition:</p> <pre><code>if ('POST' == $_SERVER['REQUEST_METHOD']) { if ( !empty($_POST['submitType']) &amp;&amp; ( $_POST['submitType'] == 'like' ) ) { $sql = "UPDATE table set `likes` = `likes`+1 where `product_id` = '1'"; $result=mysql_query($sql); } } </code></pre> <p>and in html:</p> <pre><code>&lt;input type = "submit" name="submitType" value = "like"/&gt; </code></pre>