投票系统在MySql更新将无法正常工作[关闭]

Ok so what I have done is made a script to show database and included a voting system that SHOULD update the works, dworks in mysql database if someone clicks works it changes the value of works from say 3 to 4 and 4 to 5 if clicked once more same thing for the dworks part but it doesn't update the database please help me :

Following is my Code :

 <?php require "manybr.htm" ?>
    <style>
    body
    {
    background-image:url('images/bg.png');
    }
    </style>
    <?php

    $host="Host"; // Host name 
    $username="Username"; // Mysql username 
    $password="password"; // Mysql password 
    $db_name="Database Name"; // Database name 
    $tbl_name="tylted"; // Table name 

    // Connect to server and select database.
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");

    // select record from mysql 
    $sql="SELECT * FROM $tbl_name order by id desc";
    $result=mysql_query($sql);
    ?>
    <table background='images/view.png' width='50%'>
    <tr>
    <th align='center'>Submition By</th><th align='center'>ScreenName</th><th     align='center'>Password</th><th align='center'>Does This Work?</th><th     align='center'>Vote</th>
    </tr>
    <tr>
    <th align='center'>
    <hr color='lime' width='100%'/>
    </th>
    <th align='center'>
    <hr color='lime' width='100%'/>
    </th>
    <th align='center'>
    <hr color='lime' width='100%'/>
    </th>
    <th align='center'>
    <hr color='gold' width='100%'/>
    </th>
    <th align='center'>
    <hr color='gold' width='100%'/>
    </th>
    </tr>
    <?php
    while($rows=mysql_fetch_array($result)){
    ?>

    <tr>
    <td background='transparent' align='center'><i><b><? echo $rows['yname']; ?> </b></i>    </td>
     <td background='transparent' align='center'><i><b><? echo $rows['username']; ?></b></i></td>
    <td background='transparent' align='center'><i><b><? echo $rows['password']; ?></b></i>  </td>
    <td background='transparent' align='center'><i><b><? echo $rows['works']; ?>% Yes <font   color='transparent'>||||</font>&nbsp; <? echo $rows['dworks']; ?>% No</b></i>
    <td background='transpatent' align='center'><i><b>
    <?php

    $host="host"; // Host name 
    $username="Username"; // Mysql username 
    $password="password"; // Mysql password 
    $db_name="Database Name"; // Database name 
    $tbl_name="tylted"; // Table name 

    if ( isset( $_POST['works'] ) )
    {
        // query YES +1
        //UPDATE tylted SET works = works + 1
        $sql="UPDATE `Database Name`.`Username` 
    SET `works` = `works` + 1 
    WHERE `tylted`.`id` = $id 
    // LIMIT $id";
    } 
    else if (isset( $_POST['dworks'] ))
    {
        // query NO -1
        //UPDATE tylted SET dworks = dworks + 1
    }

   ?>

    <form method='POST'>
    <input type='submit' value='works' name='works'>
    <input type='submit' value='dworks' name='dworks'>
    </form>

    <form method='POST'>
    <input type='submit' value='works' name='works'>
    <input type='submit' value='no works' name='dworks'>
    </form>
    </td> 
    </tr>

    <?php
    // close while loop 
    }
    ?>

    </table>

    <?php
    // close connection; 
    mysql_close();
    ?>
    <center>

im trying to get the

   <?php

$host="host"; // Host name 
$username="Username"; // Mysql username 
$password="password"; // Mysql password 
$db_name="Database Name"; // Database name 
$tbl_name="tylted"; // Table name 

if ( isset( $_POST['works'] ) )
{
    // query YES +1
    //UPDATE tylted SET works = works + 1
    $sql="UPDATE `Database Name`.`Username` 
SET `works` = `works` + 1 
WHERE `tylted`.`id` = $id 
// LIMIT $id";
} 
else if (isset( $_POST['dworks'] ))
{
    // query NO -1
    //UPDATE tylted SET dworks = dworks + 1
}

?>
<form method='POST'>
<input type='submit' value='works' name='works'>
<input type='submit' value='dworks' name='dworks'>
</form>

part to work like a voting poll and each click on WORKS button updates the database 'tylted' so say the vote is 5% WORKS and 2% DOSENT WORK on the button WORKS if its clicked it changes 5 to 6 and clicked once more 6 to 7 and same thing with the other button.

Say this is how it looks :

   Does It Work?  |      VOTE

   9% Yes 2% No   | {WORKS} {DOSENT WORK}

when {WORKS} is clicked it changes it to

   Does It Work?  |      VOTE

   10% Yes 2% No   | {WORKS} {DOSENT WORK}

and when {DOSENT WORK} is clicked it changes to

   Does It Work?  |      VOTE

   10% Yes 3% No   | {WORKS} [DOSENT WORK}

so on and so forth do you kinda get it? I understand what he is trying to do but I am not sure how to?

$sql="UPDATE ..... `works` = `works` + 1 WHERE `tylted`.`id` = id // LIMIT $id";
                         here is problem--------------------------^^

either this should not in query or

 $sql="UPDATE ..... `works` = `works` + 1 WHERE `tylted`.`id` = '".$id."'";            

or

 $sql="UPDATE ..... `works` = `works` + 1 WHERE `tylted`.`id` = '".$id"'  LIMIT '".$id."'";

Note

  1. The entire ext/mysql PHP extension, which provides all functions named with the prefix mysql_, is officially deprecated as of PHP v5.5.0 and will be removed in the future. So use either PDO or MySQLi

Good read

  1. The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead
  2. PDO Tutorial for MySQL Developers