Jump to content

Function Problem For A Site. Please Help


Jukebox42

Recommended Posts

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:

[code]<?php

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

?>[/code]

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

[code]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>";
}
[/code]
once the script meets the "DisplayNav();" line it stops running. so my site when run spits out:

[code]<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>
[/code]

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]?
Link to comment
Share on other sites

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

[code]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);
    }
[/code]

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...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.