How can i post integer id in database manually without a duplication.I tried many codes but not working.
Below is my code how can i check if id is empty and Post id without duplicating
<input type="hidden" name="id" value="1"/>
<?php
$id = $_POST['id'];
$query = mysql_query("SELECT * FROM table") or die(mysql_error());
while ($row = mysql_fetch_assoc($query)){
$id = $row['id'];
$i=1;
if($row['id']!=$id){
$i=1;
}
$id = $row['id'];
$query="INSERT INTO table (id,name,) VALUES('$id','$name')";
i++;
?>