MySql没有插入

Is not giving me any error, I am already linked with server but I am still unable to get it work.

It's still unable to add message, do you see any errors?

function pridaj_tovar() {

    if ($link = spoj_s_db()) {    
    $sql = "INSERT INTO `Auto-Moto`".
            "(`Tovar`, `Kategoria`,`Mesto`, `Cena`, `ID`, `Popis`)".
            "VALUES".
            "('$_POST['nazov']', '$_POST['kategorie']', '$_POST['mesta']',' $_POST['cena']', NULL,'$_POST['popis']')";
        $result = mysql_query($sql, $link); 
        if ($result) {
            // unable to add
        echo '<p>inserting was successful.</p>'. "
"; 
    } else {
            // unable to add!
        echo '<p class="chyba">Nastala chyba pri pridávaní tovaru.</p>' . "
";  
    }
        mysql_close($link);
    } else {
        // NEpodarilo sa spojiť s databázovým serverom!
        echo '<p class="chyba">NEpodarilo sa spojiť s databázovým serverom!</p>';
    }
  }

This is how you should handle field and table names with spaces,dashes (etc) :

  $sql = "INSERT INTO `Auto-Moto`".
   "(`Tovar`, `Kategoria`,`Mesto`, `Cena`, `ID`, `Popis`)".
   "VALUES".
   "('Something', 'Something1', 'word', '50', NULL, 'anotherword')";

  $sql = "INSERT INTO `Auto-Moto`". 
         "(`Tovar`, `Kategoria`,`Mesto`, `Cena`, `ID`, `Popis`)". 
         "VALUES". " 
         ('{$_POST['nazov']}', '{$_POST['kategorie']}', '{$_POST['mesta']}','{$_POST['cena']}',  
  NULL,'{$_POST['popis']}')";

If you want to see an error message change this line:

$result = mysql_query($sql, $link);

To this:

$result = mysql_query($sql, $link) or die ("Error in query: $query. " . mysql_error());

But you should really learn to use mysqli_* extensions since mysql_* extensions—such as what you are using—will be depreciated in PHP 5.5. So change that to this:

$result = mysqli_query($sql, $link) or die ("Error in query: $query. " . mysqli_error());

And be sure to change any other mysqli_* extensions you code might have in place, such as in the spoj_s_db() function you are calling as the $link for a DB connection.

Additionally, your $sql has a few formatting errors. Try this instead:

$sql = "INSERT INTO Auto-Moto"
     . " (Tovar, Kategoria, Mesto, Cena, ID, Popis)"
     . " VALUES"
     . " ('Something', 'Something1', 'word', '50', NULL, 'anotherword')"
     ;

Note the spaces in the query around the . " concatenation strings. In your original query the formatting had no spaces at all. Which would cause MySQL to choke on the query.

You have several problems in your way of making query.

Firstly, your table name is quite non standard (Auto-Moto) so you might need to add quotes around it. Secondly, it is always a good practice to add some space on proper locations so you could change:

"VALUES"

with " VALUES "

But you need to provide which error you have received and your table structure.

You missed a lot of space in your Query :

Copy this :

$sql = "INSERT INTO Auto-Moto ".
       "(Tovar, Kategoria, Mesto, Cena, ID, Popis) ".
       "VALUES ".
       "('Something', 'Something1', 'word', '50', NULL, 'anotherword')";