Stumped

Forum
Last Post
Threads / Messages

Fireballchad

Member
Member
Joined
Aug 28, 2009
Messages
49
Points
0
Age
32
Mysidian Dollar
4,928
lol Right now I am trying to figure out how to do something... but either my server is stupid and keeps breaking or I am way to tired... I think its both.
PHP:
// I cant get it to this for some reason
$newclicks = $totalclicks + $bonus;
Its normaly + 1 but it will not accept $bonus for some reason its bugging me... I have the var set correctly from the data base it will show up in the page when i call it but it wont do the clicks :( and earlier i had two $thingone + $thingtwo = $thingthree they where working but they died also...
 
Really? I have code which runs with this:
PHP:
			$newbalance = $money + $wordcount;
From what I see in your code, it should work. Have you made sure that $bonus is being declared?
 
tommyk1210 said:
above it just put
PHP:
$bonus = 1;

I was attempting to ad a feature where you buy and item and it gives you an extra click bonus... I had $bonus become the correct number while querying it from the data base, but it broke the clicks for some reason. When someone clicks it said you did it and logs it but it does not give you the clicks it gives you 0.
 
Make sure that you're getting $bonus correctly - a few weeks ago, I almost totally restructured a piece of code, and then I noticed that it just wasn't getting the most important variable from the database correctly.
 
Fireballchad said:
tommyk1210 said:
above it just put
PHP:
$bonus = 1;

I was attempting to ad a feature where you buy and item and it gives you an extra click bonus... I had $bonus become the correct number while querying it from the data base, but it broke the clicks for some reason. When someone clicks it said you did it and logs it but it does not give you the clicks it gives you 0.

It would be easier to just put $bonus = 1 if that is what it always is. This puts less strain on the sevrer and increases the speed of the script if it doesnt need to query the database. Have you tried it without using the database?
 
However, what if bonus is different? What would be the point of bonus being one? Then it would just be the same as a normal script. :/
 
Well in all intents and purposes the script should work as he currently has it.

@Fireballchad: May we look at the script? Maybe we can spot an error as the script should work as you described it.
 
tommyk1210 said:
Well in all intents and purposes the script should work as he currently has it.

@Fireballchad: May we look at the script? Maybe we can spot an error as the script should work as you described it.

Oh I put it back to normal because I could not get it to work properly.
I will show you what I was attempting to do.
PHP:
	          $query = "SELECT * FROM `adopts_users` WHERE `username`='$loggedinname'";
                  $result = mysql_query($query);
                  $num = mysql_numrows($result);
                  
                  $i = 0;
                  while ($i < 1) {
                      $bonus = @mysql_result($result, $i, "bonus");
                      $i++;
				  }

$newclicks = $totalclicks + $bonus;// Add 1 click to the current click total of this adoptable...
	

	// Actually insert our click information into the database...

	$query = "UPDATE ".$prefix."owned_adoptables SET totalclicks='$newclicks' WHERE aid='$id'";
	mysql_query($query);

***Edit
Hmmm I just changed it on my script to see if it could work... and it worked... I have no clue why it was not working before hand...
 
Similar threads
Thread starter Title Forum Replies Date
P stumped. i really need help. Questions and Supports 21

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,278
Messages
33,127
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top