DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • September 18, 2018, 06:51:36 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: SQL Database not being updated..  (Read 4148 times)
0 Members and 1 Guest are viewing this topic.
Arune
Member
Mod God
*****
Offline Offline

Posts: 718


Arune Vai - khatfield


View Profile WWW
« on: June 17, 2004, 08:55:30 PM »

Figured I'd ask and see if anyone could tell me if they see something wrong here... This script previously worked fine, but I have restored it from a backup after I moved servers, and I'm not sure if this was the most recent version. Face value the script works, but its not updating the sql database.

This was originally Lonny's code, so before anyone fusses that I stole it, I got permission first to use it. Not sure where this issue is coming from, maybe you guys can see something I'm missing.

http://dragonprime.cawsquad.net/users/khatfield/bait.zip


Issue is, someone buys something... The vendor hands the person the item... Although, its not updated in MYSQL. But its not erroring.../shrug

Here is what is extremely odd.. Its not taking away money, but it is taking away trades when you try to buy.

Weirdest thing is:
                output("`!The man takes your money and hands you $buy bait worms.");
                $cost=($buy * $session[user][wormprice]);
                $session[user][gold]-=$cost;
                $session[user][worms]+=$buy;
                $session[user][trades]-=1;
            }

Trades are the last thing it does...I'm just clueless wtf is happening.
« Last Edit: June 17, 2004, 09:00:36 PM by Arune » Logged
dvd871
Guest
« Reply #1 on: June 17, 2004, 10:04:36 PM »

Have you tried to echo out the values of the variables and see what the data is?
Logged
Arune
Member
Mod God
*****
Offline Offline

Posts: 718


Arune Vai - khatfield


View Profile WWW
« Reply #2 on: June 17, 2004, 10:11:24 PM »

No, I probably should do that. Once I do that I'll post.

Thx
Logged
Excalibur
Member
Mod God
*****
Offline Offline

Posts: 573


I'm a newbie, plz forgive me!


View Profile WWW
« Reply #3 on: June 18, 2004, 01:35:32 AM »

I've gotta crazy to find out why it didn't work, but finally I've found out Grin

This are the lines of code where you buy worms:

if ($HTTP_GET_VARS[op]=="wormbuy2"){
   $buy = $HTTP_POST_VARS[buy];
   if ($buy > (50 - $inventory)) $buy = (50 - $inventory);
        if ($session[user][gold] < ($buy * $session[user][wormprice])) output("You can't afford that!");
        else{
                output("`!The man takes your money and hands you $buy bait worms.");
                $cost=($buy * $session[user][wormprice]);
                $session[user][gold]-=$cost;
                $session[user][worms]+=$buy;
                $session[user][trades]-=1;
            }
   addnav("`!Buy Something Else","bait.php?op=trade");
   addnav("`@Return to Pool","village.php");
    }

You need to insert the line in bold yellow to make it works in each loop of sell/buy.

Beside that I get an error in IE for this line of code:
Code:
output("<script language='JavaScript'>document.getElementById('bet').focus();</script>",true);
I suppose this is the cause for the non functionality of the script, maybe you miss something on your server.
Ask Lonny if you miss a .js file, in the meanwhile you can rem the Javascript lines, and add the $_POST command.

Rgds Excalibur
Logged

Spock: Random chance seems to have operated in our favor.
McCoy: In plain, non-Vulcan English, we've been lucky.
Spock: I believe I said that, Doctor.
Arune
Member
Mod God
*****
Offline Offline

Posts: 718


Arune Vai - khatfield


View Profile WWW
« Reply #4 on: June 18, 2004, 07:26:44 AM »

Excellent, I'll try it when I get home from work! Thanks =)
Logged
Excalibur
Member
Mod God
*****
Offline Offline

Posts: 573


I'm a newbie, plz forgive me!


View Profile WWW
« Reply #5 on: June 18, 2004, 07:31:25 AM »

I forgot to say that I've remmed the JavaScript line  Wink
Logged

Spock: Random chance seems to have operated in our favor.
McCoy: In plain, non-Vulcan English, we've been lucky.
Spock: I believe I said that, Doctor.
thegleek
Guest
« Reply #6 on: June 18, 2004, 07:36:13 AM »

actually, there's no real good reason to comment that javascript line out.

it just places focus on the input window in the form, but the prob is many ppl steal/borrow code and fail to realize how it all works...

first, here's the code in question:

Code:
output("<form action='bait.php?op=wormbuy2' method='POST'><input name='buy' id='buy'><input type='submit' class='button' value='buy'></form>",true);

output("<script language='JavaScript'>document.getElementById('bet').focus();</script>",true);

now if you look CLOSELY... the input name field is called -buy-... and the javascript is trying to focus on the input box (document.getElementById) called -bet- which doesnt exist, causing the error... to fix this, simply rename bet to buy and all will be good in the world.

« Last Edit: June 18, 2004, 07:36:47 AM by thegleek » Logged
Arune
Member
Mod God
*****
Offline Offline

Posts: 718


Arune Vai - khatfield


View Profile WWW
« Reply #7 on: June 18, 2004, 07:51:14 AM »

Not that I failed to realize how it all worked.. It worked previously, its broken now. As far as stealing/borrowing code. I think Im fairly established in the LoGD neighborhood. I believe this is my first to ask for help, and I'd rather not be put down for doing so.
Logged
Excalibur
Member
Mod God
*****
Offline Offline

Posts: 573


I'm a newbie, plz forgive me!


View Profile WWW
« Reply #8 on: June 18, 2004, 08:09:25 AM »

it just places focus on the input window in the form, but the prob is many ppl steal/borrow code and fail to realize how it all works...
Without these lines your post would be perfect. I don't see any reason to flame Arune, and you don't need to flame to right and left only cause you know PHP, or JavaScript or any other programming language.
Try to be more constructive and less critical in your posts in the future, you'll surely be more likeable.

Rgds Excalibur
Logged

Spock: Random chance seems to have operated in our favor.
McCoy: In plain, non-Vulcan English, we've been lucky.
Spock: I believe I said that, Doctor.
Arune
Member
Mod God
*****
Offline Offline

Posts: 718


Arune Vai - khatfield


View Profile WWW
« Reply #9 on: June 18, 2004, 08:16:08 AM »

Excalibur,
 That works great, all fixed. Thanks alot for your help =)
Logged
Excalibur
Member
Mod God
*****
Offline Offline

Posts: 573


I'm a newbie, plz forgive me!


View Profile WWW
« Reply #10 on: June 18, 2004, 01:59:04 PM »

np Arune, you're welcome  Smiley
Logged

Spock: Random chance seems to have operated in our favor.
McCoy: In plain, non-Vulcan English, we've been lucky.
Spock: I believe I said that, Doctor.
thegleek
Guest
« Reply #11 on: June 18, 2004, 03:18:21 PM »

Without these lines your post would be perfect. I don't see any reason to flame Arune, and you don't need to flame to right and left only cause you know PHP, or JavaScript or any other programming language.
Try to be more constructive and less critical in your posts in the future, you'll surely be more likeable.

Rgds Excalibur

OMG PPL! LIGHTEN THE HECK UP! WILL YA?

i am totally sorry for sounding like i was flaming arune. but i wasn't. i do come across sometimes as harsh. but i type so fast without thinking. hey - it happens.

as u can see i just programmed a roulette mod for us - so dont think i'm just some idiot that doesn't care about this logd community and the people in it.

just plz lighten up. i dont attack anyone. (not on purpose)  sheesh!

if you want i can purchase a hallmark card and sent it to arune so all will be well again between us! Smiley

love,

thegleek
« Last Edit: June 18, 2004, 03:19:15 PM by thegleek » Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Version 1.1.2 is the current supported version and is available for download.

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
34 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search