I am using this below. Will it prevent ID duplication?
Code:
$new_generating_id
= on the process page this will be generating a new id for each time the process page is being processed;
$sql = "select `Message_id` from `queries_sent`
where message_id='$new_generating_id'";
$query = mysql_query($sql) or die ("Error: ".mysql_error());
while ($row = mysql_fetch_array($query)){
$storedid = $row['Message_id'];
}
mysql_free_result($query);
if ( $new_generating_id == $storedid ) {
echo("An error occured.");
die('');
} else {
echo('');
}
To play around with it to see if it works, I tested it by using known variables.
I changed $new_generating_id
to an id that exists and when the db pulled it it gave the error message. What do you guys think?