SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict blizzman24's Avatar
    Join Date
    Jul 2004
    Location
    Texas
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php explode not reading the url

    I have an html file that pulls info from a php file in another directory using 'require: etc'.

    the url looks like this...

    mysite.com/apples/red

    the php file is like this.

    PHP Code:
    if(isset($PATH_INFO))
    {
        
    $array=explode('/'$PATH_INFO);
    }

    $h1 str_replace("_"," ",$array[1]); 
    ^^^ array has nothing stored.

    It will read the info when they two files are in the same directory, but when I seperate them, the php file won't read the url at all. Like... if I echo a random word, it will display on the html page so I know that I linked the two correctly.

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    try

    print_r($array);

    to have a look at whats going on, perhaps $array[1] is empty.

  3. #3
    SitePoint Addict blizzman24's Avatar
    Join Date
    Jul 2004
    Location
    Texas
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that's the thing.. it is empty and I don't know why.

  4. #4
    SitePoint Addict blizzman24's Avatar
    Join Date
    Jul 2004
    Location
    Texas
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well i fixed that problem by making a path_info.php file and placing it in the main directory... now it says I can't connect to my mysql server for some reason... :'(

    is there smoething that I need to change when connecting to mysql from a diff directory?


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
  •