Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts

    doquery doesn't update

    When I run this query it has no errors, it runs but nothing is actually updated. Does anything look wrong to you?

    Code:
    doquery("UPDATE people SET ".$trow['poof2']."=".$trow['poof2']."-".$trow['amountwo'].", ".$trow['poof']."=".$trow['poof']."+".$trow['amountone']." WHERE id='".$loginrow["id"]."' LIMIT 1",);

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    When I run this query it has no errors,
    How do you know that?
    Code:
    WHERE id='".$loginrow["id"]."' LIMIT 1",);
    and that comma at the end is for what?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    All my other queries process that way. The limit is to have the query only update that user. So it doesn't attempt to update more.

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    2,959
    Thanks
    2
    Thanked 304 Times in 296 Posts
    The posted code generates a fatal parse error because of the comma that abduraooft mentioned and the page that code is on never executes.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #5
    Regular Coder lokeshshettyk's Avatar
    Join Date
    Aug 2008
    Location
    On the way to the moon!
    Posts
    157
    Thanks
    5
    Thanked 20 Times in 20 Posts
    The comma at the end of the statement makes no sense as abduraooft said and what's with this,

    ".$trow['poof']."+".$trow['amountone']."

    shouldn't that be something like

    ".($trow['poof'] + $trow['amountone'])."

    I am just guessing...

    Cheers

  • #6
    Regular Coder lokeshshettyk's Avatar
    Join Date
    Aug 2008
    Location
    On the way to the moon!
    Posts
    157
    Thanks
    5
    Thanked 20 Times in 20 Posts
    my mistake, accidentally clicked submit twice - ignore this
    Last edited by lokeshshettyk; 12-18-2008 at 02:35 PM.

  • #7
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    Quote Originally Posted by lokeshshettyk View Post
    The comma at the end of the statement makes no sense as abduraooft said and what's with this,

    ".$trow['poof']."+".$trow['amountone']."

    shouldn't that be something like

    ".($trow['poof'] + $trow['amountone'])."

    I am just guessing...

    Cheers
    Well see maybe that is why it doesn't work. I've used single fields before, but have never used a query field in a query.
    The comma is needed between the two update fields because it's adding to one, and subtracting from the other.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •