Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Some help witha VIP adding script.
Old 02-19-2007, 09:53 AM Some help witha VIP adding script.
Skilled Talker

Posts: 78
Name: Ash Kwil
Trades: 0
Ok well i want this script to add a certain member VIP privaleges.

Heres what i coded.

Code:
if ($view == "vipmem") {
echo "<BR><BR><B>Make A Member V.I.P:<form action=admin.php?step=vipadd method=post>";
  echo "Id: <input size=5 type=text name=who><input type=submit value=Submit!></form></B><br>";
}
if ($step == "vipadd") {
  $vip = mysql_query("select * from players where id=$who");
  $vips = mysql_fetch_array($vip);
mysql_query("UPDATE players SET `credits`='credits+500000' `platinum`='platinum+200' `vip`='Y' WHERE `id`='$who'");
Print "You made is $who VIP!";
} else {
Print "VIP Adding Failed";
include"footer.php";
exit;
}
It doesnt add any credits ro platinum to the player AND it constantly shows VIP adding failed at the bottom of the page no matter which admin option im on.

Thanks i advance

Ash~
Ashkwil is offline
Reply With Quote
View Public Profile Visit Ashkwil's homepage!
 
 
Register now for full access!
Old 02-19-2007, 02:34 PM Re: Some help witha VIP adding script.
Skilled Talker

Posts: 78
Name: Ash Kwil
Trades: 0
Anyone wanna help?
Ashkwil is offline
Reply With Quote
View Public Profile Visit Ashkwil's homepage!
 
Old 02-19-2007, 06:03 PM Re: Some help witha VIP adding script.
Skilled Talker

Posts: 78
Name: Ash Kwil
Trades: 0
bump...
Ashkwil is offline
Reply With Quote
View Public Profile Visit Ashkwil's homepage!
 
Old 02-20-2007, 03:28 AM Re: Some help witha VIP adding script.
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Obviously register_globals are off while the script is designed considering it is on. Very bad style of programming.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 02-20-2007, 07:02 PM Re: Some help witha VIP adding script.
memberpro's Avatar
Super Talker

Posts: 143
Trades: 0
Quote:
Originally Posted by Ashkwil View Post
Ok well i want this script to add a certain member VIP privaleges.

Heres what i coded.

Code:
if ($view == "vipmem") {
echo "<BR><BR><B>Make A Member V.I.P:<form action=admin.php?step=vipadd method=post>";
  echo "Id: <input size=5 type=text name=who><input type=submit value=Submit!></form></B><br>";
}
if ($step == "vipadd") {
  $vip = mysql_query("select * from players where id=$who");
  $vips = mysql_fetch_array($vip);
mysql_query("UPDATE players SET `credits`='credits+500000' `platinum`='platinum+200' `vip`='Y' WHERE `id`='$who'");
Print "You made is $who VIP!";
} else {
Print "VIP Adding Failed";
include"footer.php";
exit;
}
It doesnt add any credits ro platinum to the player AND it constantly shows VIP adding failed at the bottom of the page no matter which admin option im on.

Thanks i advance

Ash~
Ok... I am guessing here, because I don't completely understand your code... so here goes.

The first problem I see is you are using the method=Post using a form but are using the GET syntax (i.e. admin.php?step=vipadd ) So when you declare the variable $step how does the program know if you want the POST or GET global of 'step'.

First off... get rid of the form.. you don't need it. Just create a hyperlink to admin.php?step=vipadd . In the script, Declare the variable as $step=$_GET['step'] and you will get into the proper segment of your code to add information to your database.

Next, you query your database and then put that record into an array using
Code:
$vips = mysql_fetch_array($vip);
Now you must reference the elements of that array when you make your new query to update the database. (i.e. vips[0] is the reference for the first element in the array -- let's say this field refers to credits, vips[1] -- the second element let say is platinum)

Code:
mysql_query("UPDATE players SET `credits`='credits+500000' `platinum`='platinum+200' `vip`='Y' WHERE `id`='$who'");
will not work because the script does not know what the credit,plantinum variable are.. you must do the math outside of the query like this

Code:
$newcredit = vips[0] + 500000;
$newplat = vips[1] + 200;
 
//now do the query
mysql_query("UPDATE players SET `credits`=$newcredit `platinum`= $newplat `vip`='Y' WHERE `id`=$who");
Give that a try....
__________________

Please login or register to view this content. Registration is FREE
- step-by-step learn how to design, create and install your own website in hours...not days.
Please login or register to view this content. Registration is FREE
was never so easy.

Last edited by memberpro; 02-20-2007 at 07:38 PM..
memberpro is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Some help witha VIP adding script.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23668 seconds with 12 queries