473,554 Members | 3,188 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

output buffering, parse error unexpected t_string



I'm trying to use output buffering to cheat so i can print to excel
which is called later than this header().
header("Content-type: application/xmsdownload");
header("Content-Disposition: attachment;
header("Pragma: no-cache");
header("Expires ; 0");
print "$header\n$data ";
This is the header line it conflicts with so I surrounded it with the
buffer.
ob_start()
header( 'Content-type: text/html; charset=\"$CHAR SET\"' );
obj_end_flush()
exit;

I have a question is this buffer supposed to go around the whole php
page or only the offending header line?

I am getting an error message on the header line " Parse error: syntax
error, unexpected T_STRING in /home/allrail/public_html/header.php on
line 39"

It worked before I put the buffer around it?

thanks,

Sep 26 '08 #1
11 2916
On 26 Sep, 22:20, JRough <jlro...@yahoo. comwrote:
I'm trying to use output buffering to cheat so i can *print to excel
which is called later than this header().

* * * * header("Content-type: application/xmsdownload");
* * * * header("Content-Disposition: attachment;
* * * * header("Pragma: no-cache");
* * * * header("Expires ; 0");
* * * * print "$header\n$data ";

This is the header line it conflicts with so I surrounded it with the
buffer.
ob_start()
header( 'Content-type: text/html; charset=\"$CHAR SET\"' );
obj_end_flush()
exit;

I have a question is this buffer supposed to go around the whole php
page or only the offending header line?

I am getting an error message on the header line " Parse error: syntax
error, unexpected T_STRING in /home/allrail/public_html/header.php on
line 39"

It worked before I put the buffer around it?

thanks,
you have forgotton the semi-colons!
Sep 26 '08 #2
On Sep 26, 2:26*pm, Captain Paralytic <paul_laut...@y ahoo.comwrote:
On 26 Sep, 22:20, JRough <jlro...@yahoo. comwrote:
I'm trying to use output buffering to cheat so i can *print to excel
which is called later than this header().
* * * * header("Content-type: application/xmsdownload");
* * * * header("Content-Disposition: attachment;
* * * * header("Pragma: no-cache");
* * * * header("Expires ; 0");
* * * * print "$header\n$data ";
This is the header line it conflicts with so I surrounded it with the
buffer.
ob_start()
header( 'Content-type: text/html; charset=\"$CHAR SET\"' );
obj_end_flush()
exit;
I have a question is this buffer supposed to go around the whole php
page or only the offending header line?
I am getting an error message on the header line " Parse error: syntax
error, unexpected T_STRING in /home/allrail/public_html/header.php on
line 39"
It worked before I put the buffer around it?
thanks,

you have forgotton the semi-colons!
oh thanks, it has been a long week but it still doesn't work? Now it
says ob_end_flush() is an undefined function.
"
Fatal error: Call to undefined function obj_end_flush() in /home/
allrail/public_html/header.php on line 40"

Why is that?
Sep 26 '08 #3
On Sep 26, 2:26*pm, Captain Paralytic <paul_laut...@y ahoo.comwrote:
On 26 Sep, 22:20, JRough <jlro...@yahoo. comwrote:
I'm trying to use output buffering to cheat so i can *print to excel
which is called later than this header().
* * * * header("Content-type: application/xmsdownload");
* * * * header("Content-Disposition: attachment;
* * * * header("Pragma: no-cache");
* * * * header("Expires ; 0");
* * * * print "$header\n$data ";
This is the header line it conflicts with so I surrounded it with the
buffer.
ob_start()
header( 'Content-type: text/html; charset=\"$CHAR SET\"' );
obj_end_flush()
exit;
I have a question is this buffer supposed to go around the whole php
page or only the offending header line?
I am getting an error message on the header line " Parse error: syntax
error, unexpected T_STRING in /home/allrail/public_html/header.php on
line 39"
It worked before I put the buffer around it?
thanks,

you have forgotton the semi-colons!
okay, thanks, but I still have an error. Now it is on the preceeding
line 40.
It says obj_end_flush() is an undefined function.
"Fatal error: Call to undefined function obj_end_flush() in /home/
allrail/public_html/header.php on line 40"
How can I fix that?
Sep 26 '08 #4
On 26 Sep, 22:54, JRough <jlro...@yahoo. comwrote:
On Sep 26, 2:26*pm, Captain Paralytic <paul_laut...@y ahoo.comwrote:
On 26 Sep, 22:20, JRough <jlro...@yahoo. comwrote:
I'm trying to use output buffering to cheat so i can *print to excel
which is called later than this header().
* * * * header("Content-type: application/xmsdownload");
* * * * header("Content-Disposition: attachment;
* * * * header("Pragma: no-cache");
* * * * header("Expires ; 0");
* * * * print "$header\n$data ";
This is the header line it conflicts with so I surrounded it with the
buffer.
ob_start()
header( 'Content-type: text/html; charset=\"$CHAR SET\"' );
obj_end_flush()
exit;
I have a question is this buffer supposed to go around the whole php
page or only the offending header line?
I am getting an error message on the header line " Parse error: syntax
error, unexpected T_STRING in /home/allrail/public_html/header.php on
line 39"
It worked before I put the buffer around it?
thanks,
you have forgotton the semi-colons!

okay, thanks, but I still have an error. *Now it is on the preceeding
line 40.
It says obj_end_flush() is an undefined function.
"Fatal error: Call to undefined function obj_end_flush() in /home/
allrail/public_html/header.php on line 40"
How can I fix that?
by using the correct function name. You really must pay attention to
what the errors say and start looking things up in the manual!
Sep 26 '08 #5
On 26 Sep, 22:54, JRough <jlro...@yahoo. comwrote:
On Sep 26, 2:26*pm, Captain Paralytic <paul_laut...@y ahoo.comwrote:
On 26 Sep, 22:20, JRough <jlro...@yahoo. comwrote:
I'm trying to use output buffering to cheat so i can *print to excel
which is called later than this header().
* * * * header("Content-type: application/xmsdownload");
* * * * header("Content-Disposition: attachment;
* * * * header("Pragma: no-cache");
* * * * header("Expires ; 0");
* * * * print "$header\n$data ";
This is the header line it conflicts with so I surrounded it with the
buffer.
ob_start()
header( 'Content-type: text/html; charset=\"$CHAR SET\"' );
obj_end_flush()
exit;
I have a question is this buffer supposed to go around the whole php
page or only the offending header line?
I am getting an error message on the header line " Parse error: syntax
error, unexpected T_STRING in /home/allrail/public_html/header.php on
line 39"
It worked before I put the buffer around it?
thanks,
you have forgotton the semi-colons!

okay, thanks, but I still have an error. *Now it is on the preceeding
line 40.
It says obj_end_flush() is an undefined function.
"Fatal error: Call to undefined function obj_end_flush() in /home/
allrail/public_html/header.php on line 40"
How can I fix that?
Don't you think it's time that you realised that programming is not
your forte? You simply don't have the attention to detail or the
intelligence to carry it off.
Sep 26 '08 #6
On Sep 26, 3:00*pm, Captain Paralytic <paul_laut...@y ahoo.comwrote:
On 26 Sep, 22:54, JRough <jlro...@yahoo. comwrote:
On Sep 26, 2:26*pm, Captain Paralytic <paul_laut...@y ahoo.comwrote:
On 26 Sep, 22:20, JRough <jlro...@yahoo. comwrote:
I'm trying to use output buffering to cheat so i can *print to excel
which is called later than this header().
* * * * header("Content-type: application/xmsdownload");
* * * * header("Content-Disposition: attachment;
* * * * header("Pragma: no-cache");
* * * * header("Expires ; 0");
* * * * print "$header\n$data ";
This is the header line it conflicts with so I surrounded it with the
buffer.
ob_start()
header( 'Content-type: text/html; charset=\"$CHAR SET\"' );
obj_end_flush()
exit;
I have a question is this buffer supposed to go around the whole php
page or only the offending header line?
I am getting an error message on the header line " Parse error: syntax
error, unexpected T_STRING in /home/allrail/public_html/header.php on
line 39"
It worked before I put the buffer around it?
thanks,
you have forgotton the semi-colons!
okay, thanks, but I still have an error. *Now it is on the preceeding
line 40.
It says obj_end_flush() is an undefined function.
"Fatal error: Call to undefined function obj_end_flush() in /home/
allrail/public_html/header.php on line 40"
How can I fix that?

by using the correct function name. You really must pay attention to
what the errors say and start looking things up in the manual!
sorry,
in any case, it now compiles and brings the page however, if I leave
the exit;
step I only get a blank web page, so I guess it exits all the way
out? if I leave the exit; step then I get the same error as before:
Warning: Cannot modify header information - headers already sent by
(output started at /home/allrail/public_html/header.php:40) in /home/
allrail/public_html/header.php on line 39

does that mean I can't use the buffer?
thanks,
Sep 26 '08 #7
On Sep 26, 3:23*pm, Captain Paralytic <paul_laut...@y ahoo.comwrote:
On 26 Sep, 22:54, JRough <jlro...@yahoo. comwrote:
On Sep 26, 2:26*pm, Captain Paralytic <paul_laut...@y ahoo.comwrote:
On 26 Sep, 22:20, JRough <jlro...@yahoo. comwrote:
I'm trying to use output buffering to cheat so i can *print to excel
which is called later than this header().
* * * * header("Content-type: application/xmsdownload");
* * * * header("Content-Disposition: attachment;
* * * * header("Pragma: no-cache");
* * * * header("Expires ; 0");
* * * * print "$header\n$data ";
This is the header line it conflicts with so I surrounded it with the
buffer.
ob_start()
header( 'Content-type: text/html; charset=\"$CHAR SET\"' );
obj_end_flush()
exit;
I have a question is this buffer supposed to go around the whole php
page or only the offending header line?
I am getting an error message on the header line " Parse error: syntax
error, unexpected T_STRING in /home/allrail/public_html/header.php on
line 39"
It worked before I put the buffer around it?
thanks,
you have forgotton the semi-colons!
okay, thanks, but I still have an error. *Now it is on the preceeding
line 40.
It says obj_end_flush() is an undefined function.
"Fatal error: Call to undefined function obj_end_flush() in /home/
allrail/public_html/header.php on line 40"
How can I fix that?

Don't you think it's time that you realised that programming is not
your forte? You simply don't have the attention to detail or the
intelligence to carry it off.
sorry for the typos. Now it compiles and gives a blank page presumably
the exit; step? Without the exit step I get a fatal error to another
function on an included page. Does this mean that the buffer won't
work here?
Sep 26 '08 #8
JRough wrote:
On Sep 26, 2:26 pm, Captain Paralytic <paul_laut...@y ahoo.comwrote:
>On 26 Sep, 22:20, JRough <jlro...@yahoo. comwrote:
>>I'm trying to use output buffering to cheat so i can print to excel
which is called later than this header().
header("Content-type: application/xmsdownload");
header("Content-Disposition: attachment;
header("Pragma: no-cache");
header("Expires ; 0");
print "$header\n$data ";
This is the header line it conflicts with so I surrounded it with the
buffer.
ob_start()
header( 'Content-type: text/html; charset=\"$CHAR SET\"' );
obj_end_flush ()
exit;
I have a question is this buffer supposed to go around the whole php
page or only the offending header line?
I am getting an error message on the header line " Parse error: syntax
error, unexpected T_STRING in /home/allrail/public_html/header.php on
line 39"
It worked before I put the buffer around it?
thanks,
you have forgotton the semi-colons!

oh thanks, it has been a long week but it still doesn't work? Now it
says ob_end_flush() is an undefined function.
"
Fatal error: Call to undefined function obj_end_flush() in /home/
allrail/public_html/header.php on line 40"

Why is that?
Because you have:

obj_end_flush() ;

Not

ob_end_flush();

But if you're trying to output an excel spreadsheet they bring up in
excel, you're going about it the wrong way. You can only have one
content type for a particular file, and this one needs to be text/html
(because you're also outputting html).

What you need to do is create another file which sets the content type
for THAT file

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Sep 27 '08 #9
On Sep 26, 6:08*pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
JRough wrote:
On Sep 26, 2:26 pm, Captain Paralytic <paul_laut...@y ahoo.comwrote:
On 26 Sep, 22:20, JRough <jlro...@yahoo. comwrote:
>I'm trying to use output buffering to cheat so i can *print to excel
which is called later than this header().
* * * * header("Content-type: application/xmsdownload");
* * * * header("Content-Disposition: attachment;
* * * * header("Pragma: no-cache");
* * * * header("Expires ; 0");
* * * * print "$header\n$data ";
This is the header line it conflicts with so I surrounded it with the
buffer.
ob_start()
header( 'Content-type: text/html; charset=\"$CHAR SET\"' );
obj_end_flush( )
exit;
I have a question is this buffer supposed to go around the whole php
page or only the offending header line?
I am getting an error message on the header line " Parse error: syntax
error, unexpected T_STRING in /home/allrail/public_html/header.php on
line 39"
It worked before I put the buffer around it?
thanks,
you have forgotton the semi-colons!
oh thanks, it has been a long week but it still doesn't work? *Now it
says ob_end_flush() is an undefined function.
"
Fatal error: Call to undefined function obj_end_flush() in /home/
allrail/public_html/header.php on line 40"
Why is that?

Because you have:

obj_end_flush() ;

Not

ob_end_flush();

But if you're trying to output an excel spreadsheet they bring up in
excel, you're going about it the wrong way. *You can only have one
content type for a particular file, and this one needs to be text/html
(because you're also outputting html).

What you need to do is create another file which sets the content type
for THAT file

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
Are you saying that the content type of the excel print statement:

header("Content-type: application/xmsdownload");
conflicts with

the text type in the header?
header( 'Content-type: text/html; charset=\"$CHAR SET\"' );

I don't know about the ob_start() and ob_end_flush() statement. It
didn't seem to work in this case. Everytime I used it with the exit
after the flush I got a blank page with nothing no header no footer,
nothing.
I just decided to do a hack and requeried the database for the excel
print. There are all these nested if's I can't get out of. All I
need is the $mark and $number and my hack works. I have a question
about this form:

form action="/clm_history.php " method="post">

<tr>

<td>
<table cellspacing="0" cellpadding="2" border="0"
class="content" >
<tr><th colspan="7">Ent er car mark and number to view CLM
history</th></tr>

<tr><td class=td3 align="right">M ark</td>
<td><input type=text name='mark' size=5></td>

<td class=td3 align="right">N umber</td>
<td><input type=text name='num'></td>
</tr>
<tr>
<td></td>
<td></td>

<td></td>
<td align='right'>< input type=submit class='button'
value='Get History'</td>
shouldn't $_POST['mark'] and $_POST['num'] be posted when the user
posts to the form? If I can get the posted value then my hack will
work and I can go home.

P.s. thanks for being nice.

This validate_login is at the beginning of the page:
Validate_login( "clm_history.ph p?mark=".$mark. "&num=".$nu m);

Does that mean $mark and $num aren't posted?
thanks,
Sep 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2877
by: Salim | last post by:
Hi people, keep getting this errorParse error: parse error, unexpected T_STRING in order_fns.php line 91. the code is below for the file and I've indicated line 91 <?php function process_card($card_details) { // connect to payment gateway or // use gpg to encrypt and mail or // store in DB if you really want to
5
13141
by: Anna MZ | last post by:
I am new to php and have written the following mysql code to enter the details of a new user in the admin subdomain of my website: $sql = "INSERT INTO 'users' ('userid', 'username', 'upassword') VALUES ('$_POST', '$_POST', '$_POST') mysql_query($sql)"; When I view the code in Internet Explorer I get the following error message: ...
4
22135
kestrel
by: kestrel | last post by:
I have some html code that is supposed to be displayed by php echo. But for some reason i keep getting a syntax error, and i cant figure out what is going on. Heres what i have <?php if(isset($_GET)) { echo "<div id="visible">"; echo "<span onclick="swapform()">Log In Form</span>"; echo "</div>"; echo "<div id="theform"...
36
7972
by: rhys | last post by:
My Gurus and Angels -- Please pardon this old-school programmer, only recently enlightened to open-source, having been trapped in the convenience of proprietary lingos for way too long. My shortcomings will soon become apparent. I am developing an estimating construction system, using PHP5 and MySQL 5.0.24a with Ubuntu. I have a main...
3
2390
by: sclarkstone | last post by:
Im getting this error; Parse error: syntax error, unexpected T_STRING, expecting ':' or ';' with this line; header ('postcodesearch.php?e=nw&pcode=',); I cant find whats wrong, can anyone help?
2
3210
by: Lawrence Krubner | last post by:
Imagine a template system that works by getting a file, as a string, and then putting it through eval(), something like this: $formAsString = $controller->command("readFileAndReturnString", $formName); // 06-22-07 - the next commands try to import all the functions that the
3
5589
paulrajj
by: paulrajj | last post by:
hi to all, i am getting syntax error on my code.. Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\xampp\htdocs\Dummy\paulraj\matrim\exam.php on line 62 what's the actual problem here..? my code
0
1797
by: JRough | last post by:
On Sep 26, 3:23 pm, Captain Paralytic <paul_laut...@yahoo.comwrote: without the exit I get this again: Warning: Cannot modify header information - headers already sent by (output started at /home/allrail/public_html/header.php:40) in /home/ allrail/public_html/header.php on line 39 as well as this: Fatal error: Cannot redeclare maketr()...
10
5633
by: benicio | last post by:
Parse error: syntax error, unexpected T_STRING, expecting '(' in C:\wamp\www\study_group\includes\functions.php on line 19 I got this error and this syntax is from 8 to 19th line. <?php $subject_set = get_all_subjects(); while ($subject = mysql_fetch_array($subject_set)) { echo...
0
7583
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7783
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
6127
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5424
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5143
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1115
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
825
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.