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++;
?>
Copyright Notice:Content Author:「user3809295」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/34152985/how-to-post-id-with-auto-increment-and-without-duplication