Advanced Search

Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 32

Thread: Need some direction with this script

  1. #21
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,154
    Thanks
    260
    Thanked 690 Times in 678 Posts

    Default

    Hm. I wonder if that's an infinite loop. Add echo 1; inside the loop-- if you get thousands of 1s, then you know it's an infinite loop that times out after probably 30 seconds (depending on server settings).

    By the way:
    PHP Code:
            died('We are sorry, but there appears to be a problem with the form you submitted.'); 
    Should be die, not died. (Technically it's exit 'Message'. The other forms are aliases, which work but aren't standard. That's not too important though.)
    But that's in a comment so it shouldn't cause you any problems at the moment.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  2. #22
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,623
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by djr33 View Post
    on an unrelated note, that's a weird error. I wonder why it claims there is a ';' when there isn't one in the code at all. Traq, any ideas?
    I suppose it really means "the end came too early", and it's just not phrased well.
    I get Parse error: syntax error, unexpected '?>' ... - but I'm running 5.4. I would suspect that the ?> was simply synonymous with ; in earlier versions (since you can omit the semicolon -can, not should - in single-line statements), or, at least, resolved to the same error message.

    Quote Originally Posted by djr33 View Post
    PHP has some weird error messages (but you learn to understand them with time). One of them (in the English version of PHP) is actually written in Indonesian-- some kind of weird typo![/i]
    Are you thinking of paamayim_nekudotayim? It's Hebrew (it means "double-colon").

    Quote Originally Posted by itivae View Post
    PHP Code:
    //WORKS TILL HERE
     
    else {
        
    $query "INSERT INTO player_data (player_name, player_id, guid) 
        VALUES ('
    $player_name', '$player_id', '$guid')"
            
    $result $mysqli->query($query);
        if ( 
    false===$result ) {
      
    printf("error: %s\n"mysqli_error($mysqli));
    }
    else {
         echo 
    'Player: ' $player_name ' ' $player_id ' ' $guid ' has been added to the whitelist.';
        }
    }
    $mysqli->close();
    ?> 
    That parses fine for me...

    Try adding this immediately after you run the INSERT query:
    PHP Code:
    print '<pre>'; exit( var_dump$result ) ); 
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  3. #23
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,154
    Thanks
    260
    Thanked 690 Times in 678 Posts

    Default

    Are you thinking of paamayim_nekudotayim? It's Hebrew (it means "double-colon").
    Yeah, that's the one. Hebrew, not Indonesian. I'll remember that.

    Ok, back to the topic, I'll stop being off topic
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #24
    Join Date
    Nov 2009
    Posts
    106
    Thanks
    7
    Thanked 2 Times in 2 Posts

    Default

    Quote Originally Posted by traq View Post



    That parses fine for me...

    Try adding this immediately after you run the INSERT query:
    PHP Code:
    print '<pre>'; exit( var_dump$result ) ); 
    I still get a blank screen with this added in. i.e.
    PHP Code:
    else {

        
    $query "INSERT INTO player_data (player_name, player_id, guid) 
        VALUES ('
    $player_name', '$player_id', '$guid')"
            print 
    '<pre>'; exit( var_dump$result ) ); 
            
    $result $mysqli->query($query);
        if ( 
    false===$result ) {
      
    printf("error: %s\n"mysqli_error($mysqli));
    }
    else {
         echo 
    'Player: ' $player_name ' ' $player_id ' ' $guid ' has been added to the whitelist.';
        }
       
    }
    $mysqli->close();

    ?> 

  5. #25
    Join Date
    Nov 2009
    Posts
    106
    Thanks
    7
    Thanked 2 Times in 2 Posts

    Default

    Quote Originally Posted by djr33 View Post
    Hm. I wonder if that's an infinite loop. Add echo 1; inside the loop-- if you get thousands of 1s, then you know it's an infinite loop that times out after probably 30 seconds (depending on server settings).
    the result for this code:
    PHP Code:
    else {
    echo 
    "1";
        
    $query "INSERT INTO player_data (player_name, player_id, guid) 
        VALUES ('
    $player_name', '$player_id', '$guid')"
         
            
    $result $mysqli->query($query);
        if ( 
    false===$result ) {
      
    printf("error: %s\n"mysqli_error($mysqli));
    }
    else {
         echo 
    'Player: ' $player_name ' ' $player_id ' ' $guid ' has been added to the whitelist.';
        }
       
    }
    $mysqli->close();

    ?> 
    else {

    $query = "INSERT INTO player_data (player_name, player_id, guid)
    VALUES ('$player_name', '$player_id', '$guid')";

    $result = $mysqli->query($query);
    if ( false===$result ) {echo "1";
    printf("error: %s\n", mysqli_error($mysqli));
    }
    else {
    echo 'Player: ' . $player_name . ' ' . $player_id . ' ' . $guid . ' has been added to the whitelist.';
    }

    }
    $mysqli->close();

    ?>[/PHP]

    and

    PHP Code:
    else {
        
    $query "INSERT INTO player_data (player_name, player_id, guid) 
        VALUES ('
    $player_name', '$player_id', '$guid')"
         
            
    $result $mysqli->query($query);
        if ( 
    false===$result ) {
      
    printf("error: %s\n"mysqli_error($mysqli));
    }
    else {echo 
    "1";
         echo 
    'Player: ' $player_name ' ' $player_id ' ' $guid ' has been added to the whitelist.';
        }
       
    }
    $mysqli->close();

    ?> 
    Is still a blank screen. Both have been run with
    PHP Code:
    echo 1
    and
    PHP Code:
    echo "1"
    Am I using it correctly?
    Last edited by itivae; 03-15-2013 at 05:05 AM.

  6. #26
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,154
    Thanks
    260
    Thanked 690 Times in 678 Posts

    Default

    I was talking about the while loop above that. Is it possible that loop is never stopping?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #27
    Join Date
    Nov 2009
    Posts
    106
    Thanks
    7
    Thanked 2 Times in 2 Posts

    Default

    Sorry my mistake. Still blank with this code.

    PHP Code:
    if ($result $mysqli->query($query)){
    while (
    $obj $result->fetch_object()) {
            echo 
    '1'
           
    printf ('<div class="bans">'."%s"$obj->banned_guid);
           
    printf (" appears in the ban list" '</div>');
        }
    //WORKS TILL HERE 

  8. #28
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,154
    Thanks
    260
    Thanked 690 Times in 678 Posts

    Default

    //WORKS TILL HERE
    That doesn't make sense. It can't be blank if it "works" until that point-- you should see a lot of 1s. Back up (keep moving the echo line up the code) until you find where it actually works. Start at the top to be sure it's doing something. If not, it's a parse error and somehow this page is different than the other one.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #29
    Join Date
    Nov 2009
    Posts
    106
    Thanks
    7
    Thanked 2 Times in 2 Posts

    Default

    This is what I get

    PHP Code:
       $query "SELECT * FROM player_bans WHERE banned_guid = '$guid'";

    echo 
    '1'//here echos 1 once
     
    if ($result $mysqli->query($query)){echo '1'//here echos 1 once
    while ($obj $result->fetch_object()) {
           
           
    printf ('<div class="bans">'."%s"$obj->banned_guid);
           
    printf (" appears in the ban list" '</div>');
        }
            
    //WORKS TILL HERE 
    here it it gives this "Parse error: syntax error, unexpected T_ELSE in /home/userdirfoobar/guid-checker.php on line 35" 35 is the line where the else{} begins.
    PHP Code:
     if ($result $mysqli->query($query)){
    while (
    $obj $result->fetch_object()) {
           
           
    printf ('<div class="bans">'."%s"$obj->banned_guid);
           
    printf (" appears in the ban list" '</div>');
        }
            
    //WORKS TILL HERE
    echo '1'
     else {

        
    $query "INSERT INTO player_data (player_name, player_id, guid) 
        VALUES ('
    $player_name', '$player_id', '$guid')"
         
            
    $result $mysqli->query($query);
        if ( 
    false===$result ) {
      
    printf("error: %s\n"mysqli_error($mysqli)); 

  10. #30
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,154
    Thanks
    260
    Thanked 690 Times in 678 Posts

    Default

    Ok, good. Parse errors are displaying. You can't interrupt if (...) {...} else {....} with something before 'else'. But try it in some other places. You should be able to figure out exactly where it breaks then work out why. I suggest starting a the top of your script first, then jumping down a bit, and continue until it doesn't work (until you don't see any 1s). Then go back to find the exact spot. That's how debugging works, and, yes, it can take a while.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Similar Threads

  1. Scroll in the DOWN direction.
    By runservers in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 03-11-2008, 09:29 PM
  2. I need to put in the URL a certain direction
    By k4but0x in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 02-21-2008, 10:14 AM
  3. Image Conveyer Belt Script - change direction
    By timgundry in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 08-13-2006, 09:51 PM
  4. new to databases. need direction.
    By wiklendt in forum MySQL and other databases
    Replies: 6
    Last Post: 06-27-2006, 04:30 AM
  5. Opening direction of Overlapping Content script
    By daCyclist in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 09-07-2005, 03:55 PM

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
  •