jj20051 Posted August 20, 2008 Share Posted August 20, 2008 Ok. The Script Bellow Is Supposed To Add One To A Specific Row and Column In The Database. Unfortunately It Sets The Row To 5 No Matter What. So Either I Need A Different Code or I Need Some Help Fixing This One. $query = mysql_query("SELECT exelent FROM websites WHERE url = '$url'") or die(mysql_error()); $fun = $query + 1 ; $query = mysql_query("UPDATE websites SET exelent='$fun' WHERE url='$url'") or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
moselkady Posted August 20, 2008 Share Posted August 20, 2008 You should do it like this: $query = mysql_query("UPDATE websites SET exelent=exelent+1 WHERE url='$url'") or die(mysql_erro r()); Quote Link to comment Share on other sites More sharing options...
akitchin Posted August 20, 2008 Share Posted August 20, 2008 Mysql_Query() Will Not Return The Selected Value. It Will Return A Resource ID, From Which You Must Fetch The Number, Be It Using Mysql_Result() Or Mysql_Fetch_Array(). Alternatively, You Can Use Just One Query To Get It Done: UPDATE websites SET exelent = exelent + 1 WHERE url = '$url' please avoid capitalizing the first letter of every word. not only does it add unnecessary extra effort to your typing (i just checked), it's also just as grammatically incorrect as leaving everything in lower-case. EDIT: moselkady beat me to it, but i'm leaving this here because it's got an important sidenote. Quote Link to comment Share on other sites More sharing options...
jj20051 Posted August 20, 2008 Author Share Posted August 20, 2008 Thank You Both! Got It! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.