Hi!,
I am having problems with updating mysql database using isset. The code is:
<?php
if (isset($item_name)){
$query = "INSERT INTO downloads (user_name, item_name, total_downloads) VALUES('fred', 'doc1', '1')";
}
else
{
$query = "UPDATE downloads SET total_downloads = total_downloads+1";
}
?>
I am trying to query the database to see if item_name is empty, if it is add the record, else just add 1 to downloads. The problem is that it never updates, it just adds a new record. Am I using isset incorrectly? How do I use isset with a database value? does the variable $item_name exist?
Any help would be greatfully appreciated.