Jump to content


Photo

Function Problem For A Site. Please Help


  • Please log in to reply
2 replies to this topic

#1 Jukebox42

Jukebox42
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 June 2006 - 08:43 PM

Im having a realy anoying problem. To my knolege there is no reason why this shouldnt work. I am still a newb to PHP and I'm in over my head. I understand programing design and know how to properly format but heres my issue.

My main page "index.php" looks like this:

<?php

    session_start();
    
    //Declare Page
    var $page = "/index.php";
    var $pagename = "Home";
    
    require('main.inc');
    
    Display();

?>

And the section of code in "main.inc" that's being stubborn is:

function Display()
{
                $title = 'Clan TDG -';
        echo "<html>\n<head>\n";
        echo "<title>$title $pagename</title>\n";
        echo "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>";
        echo "<link href='main.css' rel='stylesheet' type='text/css'>\n";
        echo "</head>\n<body>\n";
        echo "<div class='pheader'><a href='login.php'>Login </a></div>\n";
        echo "<div class='pnavigation'><img src='images/nav_top.gif'>\n<br>\n";
        DisplayNav();
        echo "\n<img src='images/nav_bottom.gif'>\n";
        DisplaySpot();
        DisplayContent( $pagename );
        echo "<div class='pcopyright'><br>Copyright © 2006 Clan TDG. All rights reserved.</div>\n";
        echo "</body>\n</html>";
}
once the script meets the "DisplayNav();" line it stops running. so my site when run spits out:

<html>
<head>
<title>Clan TDG - Home</title>
</head>
<body>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
<link href='main.css' rel='stylesheet' type='text/css'>
<div class='pheader'><a href='login.php'>Login </a></div>
<div class='pnavigation'><img src='images/nav_top.gif'>
<br>

and then it stops...

Oh, I also tryed commenting out the functions and it ran so the problems got to do with the function calling another function. But i have no idea why as I am in over my head with this ".inc" stuff.

If anyone can lend a hand I would be ever greatfull. Thanks In advance.

If you need more information, or would like to see the entire pages or something you can ether email me or my AIM is [a href=\"http://aim:goim?screenname=Jukeb0x42&message=Hello+Are+you+there\" target=\"_blank\"]Jukeb0x42[/a]?

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 27 June 2006 - 09:00 PM

I dont see you wrote what the DisplayNav() does...

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 Jukebox42

Jukebox42
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 June 2006 - 09:06 PM

Oh, yea sry heres what display nav looks like. eventhough an empty function was still spitting the same error.

function DisplayNav()
    {
        $database = 'XXXXXX';
        $host = 'localhost';
        $user =  'XXXXXX';
        $password = 'XXXXXXX';
        $conn = mysql_connect ( $host, $user, $password );
        if( !$conn )
        {
            brokenLink();
        }
        $result = mysql_db_query ( "$database","SELECT * FROM XXXXXXX" );
        while ($row = mysql_fetch_assoc ($result))
        {
            echo "<a href='$row['navurl']' target='_self'><img src='nav_menu/$row['navimg']'></a><br>";
        }
        mysql_free_result ($result);
    }

this is a simple function and it should work... i use should because im a trial and error kinda person and i rarly have something correct the first try ><. Oh the X's are replacements for important things...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users