1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Query not working

Discussion in 'PHP' started by timelf123, Jun 21, 2007.

  1. #1
    <removed code>

    for now, the refid is set to a certain id, and the statusinfo is as well, but they will both be posted via ajax later on.

    Basically, and I am a very noob programmer, so there may be a better way to do what I am trying to do:

    post a users id and statusinfo to this file. if the user verified the code right, it will set a mysql column for their id to read 1, if not, then it will set it to 0

    thanks a bunch in advance, tim
     
    timelf123, Jun 21, 2007 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    $verified =" mysql_query($success) or die(mysql_error())";

    is incorrect.

    $verified = mysql_query( $success ) or die( mysql_error( ) );

    is correct

    Also, your script doesn't seem to be accepting anything from $_POST, is that all the code ?
     
    krakjoe, Jun 21, 2007 IP
    timelf123 likes this.
  3. timelf123

    timelf123 Peon

    Messages:
    897
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, I changed the unverified and verified lines.

    I am not accepting POST right now because I want to make sure the code works without introducing a form. I tried it again, and what it should do in this case is set the verification status of the user with the id of 1204 to 0, but it does nothing.

    maybe something is wrong in this line:
    $success=' UPDATE `fsr_users` SET `verified` = "1" WHERE `fsr_users`.`id` ="$refid"';
    PHP:
    ?
    What that should do is set the column verified to 1 for that particular user id
     
    timelf123, Jun 21, 2007 IP
  4. nanolab

    nanolab Active Member

    Messages:
    113
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Try this
    $success=' UPDATE `fsr_users` SET `verified` = "1" WHERE `fsr_users`.`id` = '.$refid;
    PHP:
     
    nanolab, Jun 21, 2007 IP
    timelf123 likes this.
  5. timelf123

    timelf123 Peon

    Messages:
    897
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Wow I didn't even think of that, thanks to both of you!
    + rep
     
    timelf123, Jun 21, 2007 IP
  6. timelf123

    timelf123 Peon

    Messages:
    897
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #6
    edit: fixed

    thanks!
     
    timelf123, Jun 21, 2007 IP
  7. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #7
    Yes there is.

    $variable = function_call( $args );

    this will cause $variable to be populated as soon as it is declared, you're executing both queries regardless of the rest of the script.

    Please post the entire code, or make a copy of it on the server it is on and rename it to "whatever.phps" then post a link so we can see the entire source.
     
    krakjoe, Jun 21, 2007 IP
  8. timelf123

    timelf123 Peon

    Messages:
    897
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #8
    before I post my whole file (i would need to explain the whole thing and include several other files), could I just do:
    original
    if (blah)
    {
    $unverified;
    echo "There was a problem processing your code. Please try again, and if you cannot get it to work send in a support ticket so we can manually verify you.";
    }
    PHP:
    new:
    if (blah)
    {
    mysql_query( $success ) or die( mysql_error( ) );
    echo "There was a problem processing your code. Please try again, and if you cannot get it to work send in a support ticket so we can manually verify you.";
    }
    PHP:
    and never declare $verified?
     
    timelf123, Jun 21, 2007 IP
  9. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #9
    probably, but I dunno what is in statusinfo[1] so can' say for sure, it is a mysql array, and if so what function was used to build it ?
     
    krakjoe, Jun 21, 2007 IP
  10. timelf123

    timelf123 Peon

    Messages:
    897
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #10
    That worked just fine, thanks a bunch krakjoe for the explanation. the function that was used was code for contacting telesign via SOAP to verify users.
     
    timelf123, Jun 21, 2007 IP