UPDATE link SET hits = hits+1 WHERE website_link = '$link'
$link is the website link that was clicked on.
The query works fine. The problem is if $link is a website that does not exist in the database mysql_query(); still returns true even though nothing was updated. Why is this, and anyone have any suggestions on the easiest way to check to see if $link exists in the database before updating it?
There's nothing technically wrong with the query, it simply doesn't match a link so nothing is updated. That doesn't mean the query fails. Anyhow, use mysql_affected_rows() to see if any rows were affected by your query. If it's zero, then the link probably doesn't exist.
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php