Results 1 to 8 of 8

Thread: search subdirectory

  1. #1
    Join Date
    Apr 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default search subdirectory

    Hi everyone

    I'm in a desperate situation, I hope someone can help.
    I have a search engine that use a mysql database and display 6 different images as a result.
    The problem I’m having is, that all of the images are located in one folder, now I’m having a problem to see all files through my ftp program since I’ve exceeded the amount of files allowed by my host, so I am forced to split the folder by adding 26 subdirectories (A-Z) to SEArchive directory and move all images that start with the letter “A” to the a subdirectory http://www.mysite/SEArchive/a , the same with “B” “C” etc….
    Is there a php or a function code I can add so that it will search through all 26 subdirectories until it finds the image.
    I added the codes in red and now uploads from the subdirectory, however when I try the cvdata1.php it adds the subdirectory path. example: a/Adam it should just Adam
    I would appriciate if you add the code to the script, since I'm only a novice and have a lot to learn.

    PHP Code:
    <?PHP

    function loadMember($name){
        global 
    $link;
        
        
    // Fetch total number of records
        //$SQL="SELECT * FROM ihsreg WHERE Bloom_Name ='".addslashes($name)."'";
        
    if(stristr($name,"'") && !stristr($name,"\'")){
            
    $name addslashes($name);
        }
        
    $SQL="SELECT * FROM ihsreg WHERE Bloom_Name ='".$name."'";
        
    $result mysql_query($SQL);
        
    $row mysql_fetch_assoc($result);
    [
    COLOR="Red"]    $row['Bloom_Label']=$row['Bloom_Name'];
        
    $row['Bloom_Name']=strtoupper($row['Bloom_Name'][0]) . '/' $row['Bloom_Name'];[/COLOR]    if($row['id'] != && sizeof($row) > 5){
            return 
    $row;
        } else {
            
    $row = array('id'=>1,'Bloom_Name'=>'Unknown');
            return 
    $row;
                

        }
    }

    function 
    displayImageLink($member$size = array(80,80)){
        if(
    $member['Bloom_Name']!='Unknown'){
            
    $return '<a href="javascript:show_remote(\''.addslashes($member['Bloom_Name']).'.jpg\');">';
            
    $return .= '<img width="'.$size[0].'"
        src="http://www.mysite/SEArchive/'
    .$member['Bloom_Name'].'.jpg" height="'.$size[1].'" border="0" \></a>';
        } else {
            
    $return .= '<img width="'.$size[0].'" src="http://www.mysite/SEArchive/U/Unknown.jpg" height="'.$size[1].'" \>';
        }
        return 
    $return;
    }
    function 
    loadMother($child){
        return 
    loadMember($child['Pod_Name']);
    }
    function 
    loadFather($child){
        return 
    loadMember($child['Pollen_Name']);
    }


    if(isset(
    $_REQUEST['Search_box'])){
        
        
    $search $_REQUEST['Search_box'];
        
        
    $link mysql_connect('localhost''xxxx''xxxx');
        if (!
    $link) {   die('Could not connect: ' mysql_error()); }
        
    mysql_select_db('xxxxx');
        


        
    $main loadMember($search);
        
    $mother loadMember($main['Pod_Name']);
        
    $father loadMember($main['Pollen_Name']);
        
        
    $grandmother1 loadMother($father);
        
    $grandfather1 loadFather($father);
        
        
    $grandmother2 loadMother($mother);
        
    $grandfather2 loadFather($mother);

        
    $greatgrandmother1 loadMother($grandfather1);
        
    $greatgrandfather1 loadFather($grandfather1);
        
        
    $greatgrandmother2 loadMother($grandmother1);
        
    $greatgrandfather2 loadFather($grandmother1);

        
    $greatgrandmother3 loadMother($grandfather2);
        
    $greatgrandfather3 loadFather($grandfather2);

        
    $greatgrandmother4 loadMother($grandmother2);
        
    $greatgrandfather4 loadFather($grandmother2);
        
        
    //echo "<PRE>".print_r($grandmother2,true)."</PRE>";

    }
    ?>
    Code:
    <script type="text/javascript">
    <!--
    
    function show_remote(imageSrc){
    	OpenWindow = window.open("cvdata1.php?search="+imageSrc.substring(0,imageSrc.length-4)+"", "remoteWin", "resizable=1, scrollbars=1, toolbar=1, left=0, top=0, width=800, height=390");
    	/*OpenWindow.document.write('<img width="250" height="250" src="'+imageSrc+'"><br>');
    	OpenWindow.document.write('<div align="center"><strong>'+imageSrc.split('.')[0]+'</strong><br>');
    	OpenWindow.document.write('<a href="javascript:window.close();">Close Window</a></div>');
    	*/
    	
    }
    //-->
    </script>
    Last edited by jd57; 04-30-2009 at 12:48 PM. Reason: added [code] tags

  2. #2
    Join Date
    Apr 2009
    Location
    India
    Posts
    41
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default

    you may show the url of the site......

  3. #3
    Join Date
    Apr 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    why do you need to know the site? can you help me with this problem?

  4. #4
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    The reason that we ask for a link to the site is so that we can actually observe what is happening and sometimes to see what other code, eg html, js, that you are using.

    This can help to find a solution.

    For example, your code refers to a javascript function and also to a variable, $member. What are these? How are they derived?
    Last edited by forum_amnesiac; 04-30-2009 at 01:09 PM.

  5. #5
    Join Date
    Apr 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi

    This is the search engine url http://www.internationalhibiscussoci...e/SEindex1.php to see how this work, search for “Adam” all images uploads from the SEArchive/a subdirectory this part works fine, however if you select the “Comparative Analysis” button the image uploads from the SEArchive directory and this needs to be fixed to upload from SEArchive/a subdirectory.

  6. #6
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    I'm not 100% sure about this but I think that you should be able to strip the first letter from the required image and add it to the directory string. eg

    PHP Code:
    $directory=http://xxxxxxx.com;
    $subdir=substr(trim($imagename),0,1);
    $fullpath=$directory."/"$subdir."/".$imagename

  7. #7
    Join Date
    Apr 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi
    that did not work,will you accept the script to your private mail?

  8. #8
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    Ok, I'll PM you my email.

    I'll have a look but I can't make any promises

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
  •