8, September 2008

add value to current value in DB - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: add value to current value in DB
« previous next »
Pages: [1] Print

Author Topic: add value to current value in DB  (Read 539 times)
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 884
1636 credits
Members referred : 4



« on: Aug 10, 2006, 08:00:10 PM »

ah yes here we go again another somewhat simple for you, hard for me task! Tongue

i want to make it so when a user logs in and completes the login form, their "user_clanrank" value is updated. instead of replacing it with a new value i want to simply add 5 to whatever is already there.. this would include login.php and a panel from where they login i suppose.. most likely you wont need to code for those pages to help me here tho Smiley

Visit through proxy Visit through proxy Visit through proxy

Last blog : phpHaze 1.59.1 in Development
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8037
41179 credits
Members referred : 3



« Reply #1 on: Aug 10, 2006, 08:06:00 PM »

You have to add an SQL query which will be something like :

Code:
UPDATE users SET user_clan = user_clan + 5 WHERE userID = $userID LIMIT 1

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 884
1636 credits
Members referred : 4



« Reply #2 on: Aug 10, 2006, 08:08:42 PM »

ty for refreshing my memory .. i knew the answer to this one i just .. have some memory losss.. for some reason.. Tongue ill show the working code (for what im doing) after i finish apply nik's snippet

Visit through proxy Visit through proxy Visit through proxy

Last blog : phpHaze 1.59.1 in Development
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 884
1636 credits
Members referred : 4



« Reply #3 on: Aug 10, 2006, 08:25:20 PM »

for some reason, this code is doubling the value (i put 1, and it adds 2)

Code:
<?php /*there is more before this...*/
if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) {
echo "<br><span class='small'><b>".$locale['on109']."</b></span><br />";
echo "<span class='small'>°</span> <a href='".ADMIN."index.php".$aidlink."' class='side'>".$locale['on110']."</a><br>\n";
echo "<span class='small'>°</span> <a href='".BASEDIR."administration/news.php".$aidlink."' class='side'>".$locale['on111']."</a><br>\n";
echo "<span class='small'>°</span> <a href='".BASEDIR."administration/articles.php".$aidlink."' class='side'>".$locale['on112']."</a><br>\n";
echo "<span class='small'>°</span> <a href='".BASEDIR."infusions/calendar_panel/calendar.php?funk=addein&km=".aidlink."' class='side'>Add Event</a><br>\n";
}
} else {
openside($locale['on122']);
echo "<div align='center'>".(isset($loginerror) ? $loginerror "")."<form name='loginform' method='post' action='".FUSION_SELF."'>".$locale['on123']."<br>";
echo "<input type='text' name='user_name' class='textbox' style='width:100px'><br>".$locale['on124']."<br>";
echo "<input type='password' name='user_pass' class='textbox' style='width:100px'><br>";
echo "<input type='checkbox' name='remember_me' value='y' title='".$locale['on125']."' style='vertical-align:middle;'>";
echo "<input type='submit' name='login' value='".$locale['on126']."' class='button'><br></form><br>\n";
dbquery('UPDATE fusion_users SET user_cpts = user_cpts + 1 LIMIT 1');
if (
$settings['enable_registration']) {
echo "".$locale['on127']."<br><br>\n";
}
echo $locale['on128']."</div>\n";
}
closeside();
?>

Visit through proxy Visit through proxy Visit through proxy

Last blog : phpHaze 1.59.1 in Development
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8037
41179 credits
Members referred : 3



« Reply #4 on: Aug 11, 2006, 09:06:24 AM »

I am not sure about this.

Maybe this code is executed on every new page, or you just refreshed the page by accident.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 884
1636 credits
Members referred : 4



« Reply #5 on: Aug 14, 2006, 01:37:47 AM »

nope not refreshing page, but i had to take this off, it was only working for my account and no one elses (For some reason..)

Visit through proxy Visit through proxy Visit through proxy

Last blog : phpHaze 1.59.1 in Development
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3615
Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: add value to current value in DB
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Sep 08, 2008, 10:00:16 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 36.302
Total Topics: 7.479
Total Members: 3.908
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: top10php

22 Guests, 3 Users online :

5 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.