Jump to content

[SOLVED] Add One


jj20051

Recommended Posts

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());

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.