[SOLVED]PHP DB will not INSERT more than one row

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
twick100
Forum Newbie
Posts: 4
Joined: Sun Mar 15, 2009 12:51 pm

[SOLVED]PHP DB will not INSERT more than one row

Post by twick100 »

I have got to be doing something wrong, I can insert into my database once. I run the same exact script again and it doesn't add anything.

Code: Select all

 
        $connect = mysql_connect($db_server,$db_user,$db_pass);
        if(!$connect)
        {
            die('Cannot connect to database. '.mysql_error());
        }
        
        mysql_select_db($db,$connect);
 
                $query = "INSERT INTO carts (Product_ID, Amount, Account) VALUES (".$item_id.",1,'".$user."')"; 
                mysql_query($query);
                mysql_close($connect);
 
No Fields are set to unique and te primary key is ID.

Product_ID is int(11)
Amount is int(11)
Account is text

Any help is appreciated
Last edited by twick100 on Fri Mar 20, 2009 11:16 pm, edited 1 time in total.
twick100
Forum Newbie
Posts: 4
Joined: Sun Mar 15, 2009 12:51 pm

Re: PHP DB will not INSERT more than one row

Post by twick100 »

Never mind. I forgot to make my ID Auto Increment. Sorry!

Its late... :P
Post Reply