$_session[mc_gross] question

hello… i have a question to a problem i’ve been trying to figure out for a month.

i’m working on a “bidding” script that i can’t get to work pulling out my hair.

i set mc_gross to 03.00 from the paypal ipn. now once mc_gross reaches ‘00.00’ it’s meant to

say “bid failed”, but instead it keeps saying “bid placed” when there is no money left in mc_gross.

please tell me what i’m doing wrong.

thank you in advance!

<?php mysql_connect("localhost", "user", "pass") or die(mysql_error()); mysql_Select_db("mydatabase") or die(mysql_error()); mysql_query("CREATE TABLE bids( id INT NOT NULL auto_increment, PRIMARY KEY(id), highbidder VARCHAR(100), payer_email varchar(100), seller VARCHAR(100), seller_email VARCHAR(100), weight varchar(100), composition varchar(100), color VARCHAR(100), mc_gross VARCHAR(5) )") or die(mysql_error()); echo "table created!"; ?> <?php session_start(); mysql_connect("localhost", "user", "pass") or die(mysql_error()); mysql_select_db("mydatabase") or die(mysql_error()); if($_SESSION[mc_gross] == 00.00){ print "Bid failed!"; }else{ mysql_query("UPDATE members SET mc_gross = mc_gross - 1 WHERE mc_gross > 0 AND id = '$_GET[id]'") or die(mysql_error()); mysql_query("COMMIT"); print "Bid Placed!"; } ?>

Well, you did not post any code that changes the $_SESSION[‘mc_gross’]. This variable is always the same.
You are changing the mc_gross inside the database, but, never doing any code with the SESSION variables.
Unless you just didn’t show us that code.

So far as I see, the code you gave us does this:
Creates a database
compare a SESSION variable to 00.00 (this test never changes as the SESSION variable never changes)
Subtract one from the database field also named the same as the SESSION variable.
Loop back do it again???

So, where do you load the SESSION variable named mc_gross? We can not help fix code we can not see…

Give some more ideas of your code to help us help you… Good luck…

Sponsor our Newsletter | Privacy Policy | Terms of Service