FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


HomeWatched TopicsRegisterSearchDirectory
FAQMemberlistUsergroupsLog inStoresItemsBank
Google

Reply to topic Page 1 of 1
This code won't change bits in my database
Message  

Reply with quote
Post This code won't change bits in my database 
Here's the code
Code:
if(isset($_POST['bob'])){
    $gar = $_POST['bob'];
    $player=$_SESSION['player'];
    $sar="SELECT * from dk where playername='$player'";
    $sar2=mysql_query($sar) or die("Could not get user stats");
    $sar3=mysql_fetch_array($sar2);
    $buy="update dk set gold=gold-'$gar', where playername='$player'";
    mysql_query($buy) or die("Could not buy Item");
}

can anyone help me please

View user's profile Send private message

Reply with quote
Post  
Try this:
Code:

if(isset($_POST['bob'])){
    $gar = $_POST['bob'];
    $player=$_SESSION['player'];
    $sar="SELECT * from dk where playername='$player'";
    $sar2=mysql_query($sar) or die(mysql_error());
    $sar3=mysql_fetch_array($sar2);
    $buy="update dk set gold=gold-'$gar', where playername='$player'";
    mysql_query($buy) or die(mysql_error());
}


This will generate the mysql error.


_________________
http://www.scaria.info/
View user's profile Send private message AIM Address

Reply with quote
Post Re: This code won't change bits in my database 
gobber wrote:
Here's the code
Code:
if(isset($_POST['bob'])){
    $gar = $_POST['bob'];
    $player=$_SESSION['player'];
    $sar="SELECT * from dk where playername='$player'";
    $sar2=mysql_query($sar) or die("Could not get user stats");
    $sar3=mysql_fetch_array($sar2);
    $buy="update dk set gold=gold-'$gar', where playername='$player'";
    mysql_query($buy) or die("Could not buy Item");
}

can anyone help me please

One error that exists is as follows:

replace
Code:

$buy="update dk set gold=gold-'$gar', where playername='$player'";

with this
Code:

$buy="update dk set gold=gold-'$gar' where playername='$player'";



_________________
Software Engineer
http://www.tuxmafia.com
View user's profile Send private message Visit poster's website
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  



Google

FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


Web Design by PlatinumShore.com & Web Hosting by TradeWebHosting.com