On Wednesday 28 January 2004 12:05, Jason Giangrande wrote: > I have the following query. > > 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,
Because mysql_query() returns FALSE only if there is an error in the query and something else otherwise. RTFM for details. > and anyone have any suggestions on > the easiest way to check to see if $link exists in the database before > updating it? "select website_link from link where website_link = '$link'" then use mysql_num_rows(). -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* Everything you know is wrong! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php