Forum Moderators: coopster

Message Too Old, No Replies

T FUNCTION error?

im creating a web page and keep on gettin this error.

         

nil111

9:13 am on Jul 9, 2008 (gmt 0)

10+ Year Member



erro says:
Parse error: parse error, unexpected T_FUNCTION in line 48

this is my code:

<?php
/* Include Files *********************/
session_start();
include("new_database.php");
include("new_login.php");
/*************************************/
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login ¦ #*$!</title>
<link rel="stylesheet" type="text/css" href="css/common.css">
<link href="vista_toolbar/style.css" media="all" rel="stylesheet"
type="text/css" />
<style type="text/css">
<!--
body {
background-image: url(images/back.jpg);
background-color: #CCEEF8;
background-repeat: repeat-x;
}
-->
</style></head>

<!--<body class="twoColFixRtHdr">-->
<body>
<?php
session_start();
@include_once("new_database.php");
@include_once("new_login.php");

?>
<br>
<div id="container">
<div><?php @include_once("ui_main-menu.php")?></div>

<div id="mainContent">
<?php displayLogin(); ?>
</div>
<!--<br class="clearfloat" />-->
<div><?php @include_once("ui_footer.php")?></div>
<!-- end #container --></div>
</body>
</html>


here:

ui_main-menu.php: acts like a header in all the pages.where there r links to different pages.

displayLogin(): is a function within new_login.php

Pls help me out

Sekka

9:14 am on Jul 9, 2008 (gmt 0)

10+ Year Member



Are you sure the error is within that page?

I only get 46 lines.

nil111

9:15 am on Jul 9, 2008 (gmt 0)

10+ Year Member



line 48 is the line where </html> is

nil111

9:19 am on Jul 9, 2008 (gmt 0)

10+ Year Member



hey u r rite. there's less than 48. so this means I hv missed a { or a ( somewhere is it? but really I cant find where

dreamcatcher

9:26 am on Jul 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not necessarily. Try removing the error suppression symbols (@) from your include files. See if that helps.

dc

nil111

9:33 am on Jul 9, 2008 (gmt 0)

10+ Year Member



nope that didnt help :(

Marcia

9:37 am on Jul 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<div><?php @include_once("ui_main-menu.php")?></div>

<div id="mainContent">
<?php displayLogin(); ?>
</div>
<!--<br class="clearfloat" />-->
<div><?php @include_once("ui_footer.php")?></div>


Aren't there a couple of semi-colons missing?

nil111

9:53 am on Jul 9, 2008 (gmt 0)

10+ Year Member



yea thanks I think i shld code this whole thin again. it' a mess

nil111

10:29 am on Jul 9, 2008 (gmt 0)

10+ Year Member




System: The following 3 messages were spliced on to this thread from: http://www.webmasterworld.com/php/3694211.htm [webmasterworld.com] by dreamcatcher - 11:17 am on July 9, 2008 (utc 0)


<?
/* Include Files *********************/
session_start();
include("new_database.php");
include("new_login.php");
/*************************************/
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home ¦ MySite</title>
<link rel="stylesheet" type="text/css" href="css/common.css">
<link href="vista_toolbar/style.css" media="all" rel="stylesheet"
type="text/css" />
<style type="text/css">
<!--
body {
background-image: url(images/back.jpg);
background-color: #CCEEF8;
background-repeat: repeat-x;
}
-->
</style></head>

<body class="twoColFixRtHdr">
<br>
<div id="container">
<div><?php @include_once("ui_main-menu.php")?></div>
<div id="sidebar1">
<h3>Not a member yet? Sign up here</h3>
<p>Sign up here: <a href="cafe.php">Register</a></p>
</div>

<div id="mainContent">
<h1>Sign in Here: </h1>
<? displayLogin(); ?>
</div>
<br class="clearfloat" />

<?php @include_once("ui_footer.php")?>
</div>
</body>
</html>

////////////////////////////////////////////////////////////////////

this is the error I get:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\AppServ\www\saberplex\trunk\login.php:1) in D:\AppServ\www\saberplex\trunk\login.php on line 3

Pls tel me why I get this error?

mrscruff

10:44 am on Jul 9, 2008 (gmt 0)

10+ Year Member



Do you try to start a session again in either, new_database.php, or new_login.php?

Also inclued or require should take the following format:
include 'filename.php';
include_once 'filename.php';
require 'filename.php';
require_once 'filename.php';

See [uk3.php.net...]

nil111

11:10 am on Jul 9, 2008 (gmt 0)

10+ Year Member



no im not starting sessions anywhere else

I dnt think there's a prob with the way wit 'include'. thnx

dreamcatcher

11:18 am on Jul 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please do not start a new thread for the same problem, thanks.

dc

nil111

11:46 am on Jul 9, 2008 (gmt 0)

10+ Year Member



I tot I posted a new post though

Sekka

12:11 pm on Jul 9, 2008 (gmt 0)

10+ Year Member



Are you 100% sure the error is within this file and not one of the included ones?

dreamcatcher

3:26 pm on Jul 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



And did you add the semi colons as mentioned earlier?

You can`t send any data to the browser before calling session_start. It works like the header function. This can include whitespace. You might want to read up on how sessions work:

[uk3.php.net...]

dc

Marcia

4:30 pm on Jul 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I dnt think there's a prob with the way wit 'include'. thnx

Yes, there is a problem with the includes. You've left out a required part of the line "calling" the included files. You have:

<?php @include_once("ui_footer.php")?>

That is wrong. It should be:

<?php @include_once("ui_footer.php"); ?>

You have two of them with the semi-colon missing, and that's causing an error. That's what you have to fix first, before looking any further.

nil111

5:44 am on Jul 10, 2008 (gmt 0)

10+ Year Member



I fixed that but still gettin the error. the login screen is functioning properly but the error still gets displyed.

mrscruff

9:51 am on Jul 10, 2008 (gmt 0)

10+ Year Member



Your include will work but should not have the () round the file name. The include/require are special language constructs, and useing the () can lead to problems if checking a return value.

So (even though it works):
<?php @include_once("ui_footer.php"); ?>
should be:
<?php @include_once 'ui_footer.php'; ?>

Sekka

11:12 pm on Jul 11, 2008 (gmt 0)

10+ Year Member



I use the brackets all the time, they are not the problem.

And they are required, or should at least be there by best practice, because include/require is a function requiring arguments.