I really don’t know what’s going on here, I’ve been racking my brain for ages trying to figure this out;
I have the variable $overflow = $_POST['overflow']; and then the following code:
if($overflow != "" || $overflow != "Overflow link"){
$query = "DELETE FROM links WHERE overflow='YES'";
$result = mysql_query($query) or die(mysql_error());
$query = "INSERT INTO links (link, overflow) VALUES ('$overflow','YES') ON DUPLICATE KEY UPDATE overflow=VALUES(overflow)";
$result = mysql_query($query) or die(mysql_error());
}
The idea is if $overflow is empty or holds the default value, it isn’t inserted, but if it’s a valid value the already existing entry for it is deleted (because I can’t make the column unique), and it’s re-inserted.
Anyone have any idea was to why it’s inserting on ANY value?
Any help would be greatly appreciated!
Well, it cannot be empty and “some value” at the same time, so this condition is always true. You’re looking for: