php mysql insert

I am pretty new in php programming and i’m facing with one trouble here. Probably it will be simple for all of you, but ok..

When i try to insert one row into mysql table named “novica” first time it works ok, but after that i’m unable to add any new row’s. But when i delete this row, i can add one…but again, only one. I don’t know what cause this.

here is my little php:

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

    mysql_select_db("sola", $con);
    mysql_query("INSERT INTO novica (naslov, vsebina, avtor, ustvarjeno) VALUES('$_POST[address]', '$_POST[content]', 'Klemen', NOW())");

    mysql_close($con);
?>

And here is mysql export sql code:

-- phpMyAdmin SQL Dump
-- version 3.4.10.1deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 22, 2012 at 06:41 PM
-- Server version: 5.5.28
-- PHP Version: 5.3.10-1ubuntu3.4

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `sola`
--

-- --------------------------------------------------------

--
-- Table structure for table `novica`
--

CREATE TABLE IF NOT EXISTS `novica` (
  `id_novica` int(10) NOT NULL,
  `naslov` text COLLATE utf8mb4_bin NOT NULL,
  `vsebina` text COLLATE utf8mb4_bin NOT NULL,
  `avtor` text COLLATE utf8mb4_bin NOT NULL,
  `ustvarjeno` date NOT NULL,
  `posodobljeno` date DEFAULT NULL,
  PRIMARY KEY (`id_novica`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

--
-- Dumping data for table `novica`
--

INSERT INTO `novica` (`id_novica`, `naslov`, `vsebina`, `avtor`, `ustvarjeno`, `posodobljeno`) VALUES
(0, 'a', 'a', 'Klemen', '2012-11-22', NULL);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Leave a Reply

*

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories