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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Syntax help required

    Hi.
    I am a newbie at PHP and have tried to update a column in the logged in users temp_credit, I get no errors, but more importantly do not get an update...what am I missing other than brains.....


    $intro_id = ($_SESSION["PHPAUCTION_LOGGED_IN"]);
    $query = "UPDATE PHPAUCTION_users SET temp_credit=3 WHERE id ='$intro_id'";

    Thanks in anticipation

    John

  • #2
    New Coder
    Join Date
    Oct 2005
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    did you try:

    Code:
    $intro_id = $_SESSION["PHPAUCTION_LOGGED_IN"];
    also echo it out make sure your getting results,

    and query the mysql update

  • #3
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    Hmm,

    Well, you might want to add some debugging logic.

    Try this...

    PHP Code:
    $intro_id = ($_SESSION["PHPAUCTION_LOGGED_IN"]);
    $query "UPDATE PHPAUCTION_users SET temp_credit=3 WHERE id ='$intro_id'";
    $rs mysql_query($query) or die("Could not execute query:" mysql_error()); 
    The important thing is the "or die" part of the last line. It should tell you if there's a problem with the query (from mysql's perspective).

  • #4
    New Coder
    Join Date
    Dec 2005
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    have you tried to start the session as the very first line on the page?
    PHP Code:
    <?
    session_start
    ();
    ...
    ?>


  •  

    Posting Permissions

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