SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    A code into MySQL db

    I have a site where people get a code and then they have to confirm that code and will be directed to a web page via sms along with that code in the URL.

    The URL includes $nr and $code

    So, when they go to that specific page I wanna update their field in my db, so their status is set to one and the code and number are also inserted in their field.
    But when I did the following code, the first id was updated and not the second, which is the one I was trying.

    So, can anyone see what's wrong in my very short script here?

    PHP Code:
    <?php
    error_reporting
    (0);

    include(
    "incl/sql.php");

    $nr $_REQUEST["nr"];
    $code = @urldecode($_REQUEST["code"]);

    sqlconnect();

    mysql_query("UPDATE table SET nr='$nr', status=1, reg_date=now() WHERE code='$code'") or die(mysql_error());

    mysql_close();

    echo 
    "Status is now set to 1. You can login.";
    ?>

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    there is only one thing to be updated from your script using the URL variables.
    $nr is being updated and the reference comes from $code.

    What needs to be updated and what isn't being?

    Spike
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Well, the script is looking through the table for the field with the same $code and then it should update the status field and change the zeros in reg_date and nr.
    In the field I have name, adress and so on from before. So I need to change the status and insert the registration date and the number from this line.


Bookmarks

Posting Permissions

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