SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Script prints out too many names!

    This script seemed to be working fine, when it suddenly went haywire. Instead of displaying a bread-crumbs type link, the page displays "South America" about 150 times. It also takes forever to load, and sometimes doesn't display at all.

    It would appear that my $mycode function isn't functioning. Every page has a $mycode echo function in the head section. For example, $mycode = 'arg' indicates that a page will represent Argentina. My master query generally ensures that $mycode works by default. I'm not sure why this included page is faulty.

    So I assume I need to do one of two things:

    1) Insert a line of code that makes $mycode work on this page, or

    2) Insert some sort of command that says "Display this word just once!"

    Any tips? Thanks.

    PHP Code:
    <a href="/' . str_replace(" ", "_", strtolower($r['NameParent'])) . '/"><?=$data_details['NameParent']?></a>

    <?php
    switch ($data_details['IDParent2'])
    {
       case 
    'erp':
       case 
    'asi':
       case 
    'cam':
        print 
    '(<a href="/' str_replace(" ""_"strtolower($r['NameParent'])) . '/' str_replace(" ""_"strtolower($r['NameParent2'])) . '/">' $data_details['NameParent2'] . '</a>)';
        break;
       case 
    'pac':
       case 
    'atl':
       case 
    'ino':
        print 
    '<a href="/oceanus/">Oceanus</a> &gt; <a href="/oceanus/' str_replace(" ""_"strtolower($r['NameParent'])) . '/">' $data_details['NameParent'] . '</a>';
        break;
       default:
        include (
    $_SERVER['DOCUMENT_ROOT']."/a1/inc/top/toplinks/nat.php");
        break;
    }
    ?>
     &gt; <span class="navhere"><?=$data_details['Name']?></span><br />

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wrong...
    PHP Code:
        print '(<a href="/' str_replace(" ""_"strtolower($r['NameParent'])) . '/' str_replace(" ""_"strtolower($r['NameParent2'])) . '/">' $data_details['NameParent2'] . '</a>)'
    right...
    PHP Code:
        print("<a href='"str_replace(" ""_"strtolower($r['NameParent'])) . "/" str_replace(" ""_"strtolower($r['NameParent2'])) . "'>" $data_details['NameParent2'] . "</a>"); 
    cheers


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
  •