php - Can only insert into mysql table once -


i have issue can insert data table once. if delete row , insert new one, works if have row , try insert one, doesn't work. no errors in console or network.

i'm inserting this:

<?php error_reporting(e_all); include 'db.php';  $con = mysql_connect($host,$user,$pass)     or die("error: ".mysql_error()); $dbs = mysql_select_db($databasename, $con);  $name = mysql_real_escape_string($_post['name']); $date = date('y-m-d'); $amount = $_post['amount']; $timpaid = $_post['timpaid']; $rennypaid = $_post['rennypaid'];  $sql = "insert $tablename (`name`, `date`, `amount`, `timpaid`, `rennypaid`)         values ('$name', '$date', '$amount', '$timpaid', '$rennypaid')";  $result = mysql_query($sql, $con)     or die("error: ".mysql_error());  mysql_close($con); ?> 

i'm thinking might have how table set up, primary key , such. have id column primary , think it's auto-increment, can't tell.

since not sure whether id field auto-increment or not, should alter table this,

alter table `yourtable` modify column `id`  int(11) null auto_increment first; 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -