Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8874283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:40:51+00:00 2026-06-14T18:40:51+00:00

I am pretty new in php programming and i’m facing with one trouble here.

  • 0

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 */;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:40:53+00:00Added an answer on June 14, 2026 at 6:40 pm

    Your primary key is not set to auto increment. As such when you insert a new row, the id of zero is possibly assigned, but any subsequent insert fails as that id is already taken.

    Either add the id into the insert statement or make the id_novica auto increment – http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html

    CREATE TABLE IF NOT EXISTS `novica` (
      `id_novica` int(10) NOT NULL AUTO_INCREMENT,
      `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;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to PHP, but I decided to try and make a simple
I've done a fair bit of mysql php programming but am pretty new to
I'm pretty proficient in PHP, but want to try something new. I'm also know
I'm pretty new to php.. and this is probably a stupid mistake... but I
I am pretty new to php, but I am learning! I have a simple
I'm new to php world (actually not so much, but pretty much). I make
I'm sure this is pretty elementary but I'm new to php. Can someone tell
I'm pretty new to php but i'm learning pretty fast, I have a question
I'm pretty new to PHP, I'm working in WordPress but I don't think that
I'm pretty new to OOP (and also in PHP programming), and I have some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.