Results 1 to 5 of 5

Thread: [Solved] Splitting Query String

  1. #1

    Thread Starter
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552

    Resolved [Solved] Splitting Query String

    Dunno if my question meets my needs here.

    I'm having problem with this code
    Code:
        $code=$_GET['code'];
        echo $code;
        $col=split('.',$code);
        if($col[1]=='vb'){
            $h->vb_file("source/".$code);
        }
        else if($col[1]=='cs'){
            $h->csharp_file("source/".$code);
        }
        else if($col[1]=='php'){
            highlight_file("source/".$code);
        }
    It echoes the $code (highlight.php) say I have showcode.php?code=highlight.php, but... it doesn't go through the if's. Am I missing something?
    Last edited by brown monkey; Oct 9th, 2004 at 03:01 AM.

  2. #2
    Addicted Member Phenix's Avatar
    Join Date
    Sep 2002
    Location
    Near A Cube
    Posts
    228

    Thumbs up

    Why don't you put a debugging echo statement in your if cases to see which case is true? The problem may lie in your function call inside the successful if.
    Circa 1995
    Engineer - I think we should put our website address on our paper catalogs.
    Vice President - Don't get too excited about this internet thing.


    I am sorry, but the Oracle was mistaken. You cannot help us.
    -Matrix video game


    I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. ... and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
    -Linus


    Question. Do you know that the character "?" means I'm asking a question? Question. Do you know that spoken inflection also provides the same cue? So please don't say, "Question" before you ask your question. Believe me I'll know.

    That said, I would have said this first if it had to precede what I'm telling you now. Having said that, what I'm telling you now is the same thing I just said about the annoying phrases "That said" and "Having said that".


    Are you threatening me, Master Jedi?
    -Chancellor Palpatine

  3. #3

    Thread Starter
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    Thanks for the reply. The problem is neither of the three if is true. And even $col is something of a Nothing;
    PHP Code:
        $code=$_GET['code'];
        echo 
    $code// prints highlight.php
        
    $col=split(".",$code);

        echo 
    $col[0]; // prints nothing
        
    if($col[1]=='vb'){
            echo 
    "hello world"// not executed
            
    $h->vb_file("source/".$code);
        }
        else if(
    $col[1]=='cs'){
            echo 
    "hello world"// not executed
            
    $h->csharp_file("source/".$code);
        }
        else if(
    $col[1]=='php'){
            echo 
    "hello world"// not executed
            
    highlight_file("source/".$code);
        } 

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    From PHP.Net
    split -- Split string into array by regular expression
    The regular expression "." matches any non newline character, so you'll just get an array full of blanks. Use the explode() function instead.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5

    Thread Starter
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    A very big Thank you... Pensi Master.

Posting Permissions

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



Click Here to Expand Forum to Full Width