can't redirect to Excel

This is a discussion on can't redirect to Excel within the PHP Language forums, part of the PHP Programming Forums category; On Jul 19, 12:57 pm, Bill H <b...@ts1000.us> wrote: > On Jul 19, 3:13 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

 

LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 07-19-2008
JRough
 
Posts: n/a
Default Re: can't redirect to Excel

On Jul 19, 12:57 pm, Bill H <b...@ts1000.us> wrote:
> On Jul 19, 3:13 pm, JRough <jlro...@yahoo.com> wrote:
>
>
>
> > On Jul 19, 10:54 am, John Dunlop <j...@dunlop.name> wrote:

>
> > > Bill H:

>
> > > > print "Content-type: application/excel\n\n";

>
> > > application/vnd.ms-excel is the registered MIME type.

>
> > > > then print out the spreadsheet contents (probably in CSV format)

>
> > > text/csv fits the bill.

>
> > > application/x-msdownload is one of Internet Explorer's "known" MIME
> > > types, but without wading through Microsoft's *cough* documentation of
> > > this bu^H^Hfeature,* I don't know how Internet Explorer handles it.
> > > Suffice to say, subtypes prefixed with "x-" are discouraged by RFC
> > > 2048, even more so when an appropriate type has already been
> > > registered.

>
> > > *http://msdn.microsoft.com/en-us/library/ms775147.aspx

>
> > > --
> > > Jock

>
> > Thanks for the link.

>
> > That is interesting. First I have been using Firefox but I am sure
> > that the users are using IE. So I will try it in IE on Monday. There
> > is no IE on the Mac.
> > This by the way seemed to works in my browser at leaset not saying it
> > is the right way or it works in IE.

>
> > >print "$header\n$data";
> > >print "Content-type: application/excel\n\n"

>
> > How would you add the csv extension? Something like this?
> > print "$header\n$data"."csv";
> > print "Content-type: application/vnd.ms-excel\n\n"

>
> > I'll see if I can figure out where to put the redirect on the first
> > page :-(- Hide quoted text -

>
> > - Show quoted text -

>
> I think (and I could be wrong) that with php you are used to using
> print $header to get a header for an html page, but with perl we roll
> our own header. In this case the header is:
>
> print "Content-type: text/csv\n\n" (thanks John Dunlop)
>
> For example (please excuse the use of perl code, I am learning php but
> have been using perl for 10 years) if I wanted to send a simple CSV
> (comma seperated value) spread sheet that contained a multiplication
> table when they clicked on a link I would use the following code as
> the address of the link they clicked:
>
> #!/usr/bin/perl
>
> print "content-type: text/csv\n\n";
> print qq~"","1","2","3","4","5","6","7","8","9","10"\n~ ;
> for($row = 1;$row < 11;$row++)
> {
> print qq~"$row"~;
> for($col = 1;$col < 11;$col++)
> {
> $t = $row * $col;
> print qq~,"$t"~;
> }
> print "\n";}
>
> exit;
>
> Bill H

Actually this will work, because I have a others of these to do. I
have some pages with URL links that when the user clicks it he gets
his list. Thanks very much. That would be the External User on this
page. I will try your example since I can't get the INTERNAL user
form output to redirect over to the Excel page.

I'm needing some help with that. For example, I put in the else/if
after the creation of the form before the redirection of the external
user. There is another page the External user sees and I will try
your code with that one.
Here is my page with the else/if

# * 10.22.2007
# * current_sightings.php
# * PROVIDES THE LAST CLM FOR EACH CAR IN WHATEVER PARAMETER IS
PASSED: (lease, managed group, pool, etc)
# * modified by jrough
# * 7/15/2008
# * modified to add Excel button, see note

include './includes/config.inc.php';
include $include_path.'dates.inc.php';
include $include_path."LMS_functions.inc.php";

################################################
//Is the user logged in?
Validate_login("current_sightings.php");

if(empty($id)&&($_SESSION["LMS_USER_DESC"]=='internal')){
# THIS IS id INSTEAD OF lease_id B/C ONE DAY WE MIGHT HAVE CUSTOMER
SUB GROUPS OR MANAGED CARS
$destroyed = GetDestroyed_lease_id();
$result = SELECT_leasesCLM();
$TPL_ids = "<SELECT name='id' class=box size=8>\n";
$trbg = "";

while($row = mysql_fetch_assoc($result)){
$id = $row['lease_id'];
$lnum = $row['lease_num'];
$comp = $row['comp_name'];

$trbg = GetTRBG($trbg);

$TPL_ids.=" <OPTION VALUE='".$id;
$TPL_ids.="' ".$trbg.">".$lnum." - ".$comp."</OPTION>\n";
}

$TPL_ids.="</SELECT>\n";
include "header.php";
include $template_path."current_sightings_php.html";

}elseif($_POST['assign']=='Open in Excel'){
Header("Location: http://www.MyWebSite.com/fakerockridge/current_sightingsXL.php?param=".$_Post['id']."&id=".$_id);

}elseif($_POST['redirect']&&$_POST['redirect']!=$_SERVER['PHP_SELF']){
Header("Location: ".$_POST['redirect'].".php?id=".$_POST['id']);
exit;
}else{

# DETERMINE PAGE ACCORDING TO USER TYPE
switch ($_SESSION["LMS_USER_DESC"]){
case "customer":
$id = $_SESSION["LMS_LOGGED_IN"];
$MSG_carlist = "CURRENT SIGHTINGS";
$result = SELECT_sightings_customercars($id,CLM_order_by($or der_by));
break;
case "internal":
$MSG_carlist = "CURRENT SIGHTINGS FOR ".SELECT_lease_num($id)."
".SELECT_comp_name($id);
$result = SELECT_sightings_leasecars($id,CLM_order_by($order _by));
break;
#case "internal_ltd":
# break;
}
$TPL_carnumbers = GetTableHeaders($id);
while ($row = mysql_fetch_assoc($result)){
$TPL_carnumbers.=MakeSighting($row);
}

$TPL_carnumbers.="</table>";

include "header.php";
include $template_path."template_carlist.html";

}


include "footer.php";

the error I am getting is not intelligible to me:

arning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at /home/dhandler/
public_html/fakerockridge/current_sightingsXL.php:2) in /home/dhandler/
public_html/fakerockridge/includes/config.inc.php on line 18

Warning: Cannot modify header information - headers already sent by
(output started at /home/dhandler/public_html/fakerockridge/
current_sightingsXL.php:2) in /home/dhandler/public_html/fakerockridge/
current_sightingsXL.php on line 20

thanks,
Reply With Quote
  #12 (permalink)  
Old 07-19-2008
JRough
 
Posts: n/a
Default Re: can't redirect to Excel

On Jul 19, 12:57 pm, Bill H <b...@ts1000.us> wrote:
> On Jul 19, 3:13 pm, JRough <jlro...@yahoo.com> wrote:
>
>
>
> > On Jul 19, 10:54 am, John Dunlop <j...@dunlop.name> wrote:

>
> > > Bill H:

>
> > > > print "Content-type: application/excel\n\n";

>
> > > application/vnd.ms-excel is the registered MIME type.

>
> > > > then print out the spreadsheet contents (probably in CSV format)

>
> > > text/csv fits the bill.

>
> > > application/x-msdownload is one of Internet Explorer's "known" MIME
> > > types, but without wading through Microsoft's *cough* documentation of
> > > this bu^H^Hfeature,* I don't know how Internet Explorer handles it.
> > > Suffice to say, subtypes prefixed with "x-" are discouraged by RFC
> > > 2048, even more so when an appropriate type has already been
> > > registered.



Actually this will work, because I have a others of these to do. I
have some pages with URL links that when the user clicks it he gets
his list. Thanks very much. That would be the External User on this
page. I will try your example since I can't get the INTERNAL user
form output to redirect over to the Excel page.

Reply With Quote
  #13 (permalink)  
Old 07-19-2008
JRough
 
Posts: n/a
Default Re: can't redirect to Excel


>
> What do you mean by "redirect the output to Excel"??? Excel isn't a
> location, it's a spreadsheet program that some (but not all users) will have
> on their machine.

I posted the current_sightingsXL.php page earlier

> BTW, Location: is supposed to take a fully qualified URL.

I have a fully qualified url and it still doesn't work.



include './includes/config.inc.php';
include $include_path.'dates.inc.php';
include $include_path."LMS_functions.inc.php";

################################################
//Is the user logged in?
Validate_login("current_sightings.php");

if(empty($id)&&($_SESSION["LMS_USER_DESC"]=='internal')){
# THIS IS id INSTEAD OF lease_id B/C ONE DAY WE MIGHT HAVE CUSTOMER
SUB GROUPS OR MANAGED CARS
$destroyed = GetDestroyed_lease_id();
$result = SELECT_leasesCLM();
$TPL_ids = "<SELECT name='id' class=box size=8>\n";
$trbg = "";

while($row = mysql_fetch_assoc($result)){
$id = $row['lease_id'];
$lnum = $row['lease_num'];
$comp = $row['comp_name'];

$trbg = GetTRBG($trbg);

$TPL_ids.=" <OPTION VALUE='".$id;
$TPL_ids.="' ".$trbg.">".$lnum." - ".$comp."</OPTION>\n";

}

$TPL_ids.="</SELECT>\n";
include "header.php";
include $template_path."current_sightings_php.html";

}elseif($_POST['assign']=='Open in Excel'){

Header("Location:
http://www.MyWebSite.com/fakerockridge/current_sightingsXL.php?param=".$_Post['id']."&id=".$_id);

}elseif($_POST['redirect']&&$_POST['redirect']!=$_SERVER['PHP_SELF']){

Header("Location: ".$_POST['redirect'].".php?id=".$_POST['id']);
exit;

}else{

# DETERMINE PAGE ACCORDING TO USER TYPE
switch ($_SESSION["LMS_USER_DESC"]){
case "customer":
$id = $_SESSION["LMS_LOGGED_IN"];
$MSG_carlist = "CURRENT SIGHTINGS";
$result = SELECT_sightings_customercars($id,CLM_order_by($or der_by));
break;
case "internal":
$MSG_carlist = "CURRENT SIGHTINGS FOR ".SELECT_lease_num($id)."
".SELECT_comp_name($id);
$result = SELECT_sightings_leasecars($id,CLM_order_by($order _by));
break;
#case "internal_ltd":
# break;
}

$TPL_carnumbers = GetTableHeaders($id);
while ($row = mysql_fetch_assoc($result)){
$TPL_carnumbers.=MakeSighting($row);

}

$TPL_carnumbers.="</table>";

include "header.php";
include $template_path."template_carlist.html";

}

include "footer.php";

The error I am getting is not making sense to me Can you tell me if I
should put the if/else somewhere else so I can get the output to the
Excel page to test it there?
THANKS,
arning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at /home/
dhandler/
public_html/fakerockridge/current_sightingsXL.php:2) in /home/
dhandler/
public_html/fakerockridge/includes/config.inc.php on line 18

Warning: Cannot modify header information - headers already sent by
(output started at /home/dhandler/public_html/fakerockridge/
current_sightingsXL.php:2) in /home/dhandler/public_html/
fakerockridge/
current_sightingsXL.php on line 20

Janis
Reply With Quote
  #14 (permalink)  
Old 07-19-2008
JRough
 
Posts: n/a
Default Re: can't redirect to Excel

On Jul 19, 12:41 am, "Paul Lautman" <paul.laut...@btinternet.com>
wrote:
> JRough wrote:
> >I have tried this 4 2 weeks and I need some help. There are 3 other
> > pages referenced on this page but I'm going to start with this page
> > in case I missed something. It is called current_sightings.php. All
> > I want to do is redirect to Excel in the case of the External user.
> > The first if statement creates a form. The elseif redirects the
> > external user to only his own listings. I want the results for the
> > Internal user query SELECT_sightings_leasecars.() to go to my
> > current_sightingsXL.php page. Where/How would I put the redirect? I
> > think it should be after the switch for external users. The
> > getTableHeaders() function is the string that gets passed. All the
> > pages work except I can't redirect the output to Excel.

>
> What do you mean by "redirect the output to Excel"??? Excel isn't a
> location, it's a spreadsheet program that some (but not all users) will have
> on their machine.

I have a fully qualified url and it still doesn't work. I'm not sure
I put the if/else redirect to the Excel output right? It is going to
the Excel page but I get this message. These users will have Excel
since it is their cars and they want it in Excel. Do I have the if/
else in the right place?


Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at /home/dhandler/
public_html/fakerockridge/current_sightingsXL.php:2) in /home/dhandler/
public_html/fakerockridge/includes/config.inc.php on line 18

Warning: Cannot modify header information - headers already sent by
(output started at /home/dhandler/public_html/fakerockridge/
current_sightingsXL.php:2) in /home/dhandler/public_html/fakerockridge/
current_sightingsXL.php on line 20


On line 20 of current_sightingsXL.php it is the user login
Header("Location: user_login.php");
21 exit;

Does that mean it dosn't know I am an internal user?

thanks, for any help you can provide.
Janis
---------current_sightings.php----------
<?

include './includes/config.inc.php';
include $include_path.'dates.inc.php';
include $include_path."LMS_functions.inc.php";

################################################
//Is the user logged in?
Validate_login("current_sightings.php");

if(empty($id)&&($_SESSION["LMS_USER_DESC"]=='internal')){
# THIS IS id INSTEAD OF lease_id B/C ONE DAY WE MIGHT HAVE CUSTOMER
SUB GROUPS OR MANAGED CARS
$destroyed = GetDestroyed_lease_id();
$result = SELECT_leasesCLM();
$TPL_ids = "<SELECT name='id' class=box size=8>\n";
$trbg = "";

while($row = mysql_fetch_assoc($result)){
$id = $row['lease_id'];
$lnum = $row['lease_num'];
$comp = $row['comp_name'];

$trbg = GetTRBG($trbg);

$TPL_ids.=" <OPTION VALUE='".$id;
$TPL_ids.="' ".$trbg.">".$lnum." - ".$comp."</OPTION>\n";
}

$TPL_ids.="</SELECT>\n";
include "header.php";
include $template_path."current_sightings_php.html";

}elseif($_POST['assign']=='Open in Excel'){
Header("Location:
http://www.allcapitalrailmanagement.com/fakerockridge/current_sightingsXL.php?param=".$_Post['lease_num']."&id=".$lnum);

}elseif($_POST['redirect']&&$_POST['redirect']!=$_SERVER['PHP_SELF']){
Header("Location: ".$_POST['redirect'].".php?id=".$_POST['id']);
exit;
}else{

# DETERMINE PAGE ACCORDING TO USER TYPE
switch ($_SESSION["LMS_USER_DESC"]){
case "customer":
$id = $_SESSION["LMS_LOGGED_IN"];
$MSG_carlist = "CURRENT SIGHTINGS";
$result = SELECT_sightings_customercars($id,CLM_order_by($or der_by));
break;
case "internal":
$MSG_carlist = "CURRENT SIGHTINGS FOR ".SELECT_lease_num($id)."
".SELECT_comp_name($id);
$result = SELECT_sightings_leasecars($id,CLM_order_by($order _by));
break;
#case "internal_ltd":
# break;
}
$TPL_carnumbers = GetTableHeaders($id);
while ($row = mysql_fetch_assoc($result)){
$TPL_carnumbers.=MakeSighting($row);
}

$TPL_carnumbers.="</table>";

include "header.php";
include $template_path."template_carlist.html";

}
?>
-----------

On line 18 in the config file it is simply session_start()

What could this mean?

thanks,

---------------current_sightingsXL.php-------------------



<?


require('./includes/config.inc.php');

#// ################################################
#// Is the user logged in?

if(isset($_SESSION["LMS_LOGGED_IN"])){
$_SESSION["REDIRECT_AFTER_LOGIN"] = "current_sightings.php";
Header("Location: user_login.php");
exit;
}

include $include_path."LMS_functions.inc.php";



switch($param){
case 'current_sightings':
$result =
SELECT_sightings_leasecars($id,CLM_order_by($order _by));
break;
/*case 'cars_by_location':
$result = GetCars($lease_id);
break;
case 'idle_cars':
$result = GetRest($lease_id);
break;
case 'bad_order':
$result = GetRest($lease_id);
break;*/
default:
$result = SELECT_sightings_leasecars($id,CLM_order_by($order _by));
break;
}


if(!$result){
MySQLError($query);
exit;
}

$fields = mysql_num_fields($result);


for ($i = 0; $i < $fields; $i++) {
$header .= mysql_field_name($result, $i) . "\t";
}


while($row = mysql_fetch_row($result)) {
$line = '';
foreach($row as $value)
{
if ((!isset($value)) OR ($value == "")) {
$value = "\t";
} else {
$value = str_replace('"', '""', $value);
$value = '"' . $value . '"' . "\t";
}
$line .= $value;
}
$data .= trim($line)."\n";
}
$data = str_replace("\r","",$data);


if ($data == "") {
$data = "\n(0) Records Found!\n";
}

//$filename = GetFilename($lease_id)."_".$param;
$filename = "Current Sightings ";


header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=".$filename.".xls");
header("Pragma: no-cache");
header("Expires: 0");
print "$header\n$data";







################################################## ############################################
################################################## ############################################
#######
####### QUERY FUNCTIONS
#######
################################################## ############################################
################################################## ############################################
function SELECT_sightings_leasecars($lease_id,$order_by) {
$query = "SELECT c.l_e,
c.car_mark, c.car_number,
c.location_city, c.location_state,
c.sighting_date,
e.classification,
c.railroad,
s.city as origin_city,
s.state as origin_state,
c.destination_city, c.destination_state,
t.eta
FROM INTERNAL_REMARK r, INTERNAL_CAR_LEASE cl,
clm_lastsighting_view v1,
clm_crossreference_view v2, INTERNAL_CODES e, INTERNAL_CLM c
LEFT JOIN (INTERNAL_TRIPS t, INTERNAL_SPLC s)
ON (c.trip_id = t.trip_id
AND t.origin_splc_id = s.splc_id)
WHERE cl.lease_id = ".$lease_id."
AND cl.end_date IS NULL
AND cl.remark_id = r.remark_id
AND r.car_mark = c.car_mark
AND c.car_mark = v1.car_mark
AND v1.car_mark = v2.car_mark
AND r.car_number = c.car_number
AND c.car_number = v1.car_number
AND v1.car_number = v2.car_number
AND c.sighting_date = v1.sighting_date
AND c.sighting_code = v2.code
AND c.sighting_code = e.code
ORDER BY ".$order_by;
$result = mysql_query($query);
if(!$result) {
MySQLError($query);
exit;
}
return $result;
}




?>
Reply With Quote
  #15 (permalink)  
Old 07-19-2008
Bill H
 
Posts: n/a
Default Re: can't redirect to Excel

On Jul 19, 5:15*pm, JRough <jlro...@yahoo.com> wrote:
> On Jul 19, 12:41 am, "Paul Lautman" <paul.laut...@btinternet.com>
> wrote:
>
>
>
> > JRough wrote:
> > >I have tried this 4 2 weeks and I need some help. *There are 3 other
> > > pages referenced *on this page but I'm going to start with this page
> > > in case I missed something. *It is called current_sightings.php. *All
> > > I want to do is redirect to Excel in the case of the External user.
> > > The first if statement creates a form. * *The elseif redirects the
> > > external user to only his own listings. *I want the results for the
> > > Internal user query SELECT_sightings_leasecars.() to go to my
> > > current_sightingsXL.php page. *Where/How would I put the redirect? *I
> > > think it should be after the switch for external users. *The
> > > getTableHeaders() function is the string that gets passed. *All the
> > > pages work except I can't redirect the output to Excel.

>
> > What do you mean by "redirect the output to Excel"??? Excel isn't a
> > location, it's a spreadsheet program that some (but not all users) willhave
> > on their machine.

>
> I have a fully qualified url and it still doesn't work. *I'm not sure
> I put the if/else redirect to the Excel output right? *It is going to
> the Excel page but I get this message. *These users will have Excel
> since it is their cars and they want it in Excel. *Do I have the if/
> else in the right place?
>
> Warning: session_start() [function.session-start]: Cannot send session
> cache limiter - headers already sent (output started at /home/dhandler/
> public_html/fakerockridge/current_sightingsXL.php:2) in /home/dhandler/
> public_html/fakerockridge/includes/config.inc.php on line 18
>
> Warning: Cannot modify header information - headers already sent by
> (output started at /home/dhandler/public_html/fakerockridge/
> current_sightingsXL.php:2) in /home/dhandler/public_html/fakerockridge/
> current_sightingsXL.php on line 20
>
> On line 20 of current_sightingsXL.php it is the user login
> Header("Location: user_login.php");
> *21 * * exit;
>
> Does that mean it dosn't know I am an internal user?
>
> thanks, for any help you can provide.
> Janis
> ---------current_sightings.php----------
> <?
>
> include './includes/config.inc.php';
> include $include_path.'dates.inc.php';
> include $include_path."LMS_functions.inc.php";
>
> ################################################
> //Is the user logged in?
> Validate_login("current_sightings.php");
>
> if(empty($id)&&($_SESSION["LMS_USER_DESC"]=='internal')){
> # THIS IS id INSTEAD OF lease_id B/C ONE DAY WE MIGHT HAVE CUSTOMER
> SUB GROUPS OR MANAGED CARS
> $destroyed = GetDestroyed_lease_id();
> $result = SELECT_leasesCLM();
> $TPL_ids = "<SELECT name='id' class=box size=8>\n";
> $trbg * * * = "";
>
> while($row = mysql_fetch_assoc($result)){
> $id * * * * = $row['lease_id'];
> $lnum * * = $row['lease_num'];
> $comp * * = $row['comp_name'];
>
> $trbg = GetTRBG($trbg);
>
> $TPL_ids.=" * *<OPTION VALUE='".$id;
> $TPL_ids.="' * * ".$trbg.">".$lnum." - ".$comp."</OPTION>\n";
>
> }
>
> $TPL_ids.="</SELECT>\n";
> include "header.php";
> include $template_path."current_sightings_php.html";
>
> }elseif($_POST['assign']=='Open in Excel'){
>
> * * * * Header("Location:http://www.allcapitalrailmanagement.com/fakerockridge/current_sightin...".$_Post['lease_num']."&id=".$lnum);
>
> }elseif($_POST['redirect']&&$_POST['redirect']!=$_SERVER['PHP_SELF']){
>
> Header("Location: ".$_POST['redirect'].".php?id=".$_POST['id']);
> exit;
>
> }else{
>
> # DETERMINE PAGE ACCORDING TO USER TYPE
> switch ($_SESSION["LMS_USER_DESC"]){
> case "customer":
> $id = $_SESSION["LMS_LOGGED_IN"];
> $MSG_carlist = "CURRENT SIGHTINGS";
> $result = SELECT_sightings_customercars($id,CLM_order_by($or der_by));
> break;
> case "internal":
> $MSG_carlist = "CURRENT SIGHTINGS FOR ".SELECT_lease_num($id)."
> ".SELECT_comp_name($id);
> $result = SELECT_sightings_leasecars($id,CLM_order_by($order _by));
> break;
> #case "internal_ltd":
> # break;}
>
> $TPL_carnumbers = GetTableHeaders($id);
> while ($row = mysql_fetch_assoc($result)){
> $TPL_carnumbers.=MakeSighting($row);
>
> }
>
> $TPL_carnumbers.="</table>";
>
> include "header.php";
> include $template_path."template_carlist.html";
>
> }
>
> ?>
> -----------
>
> On line 18 in the config file it is simply session_start()
>
> What could this mean?
>
> thanks,
>
> ---------------current_sightingsXL.php-------------------
>
> <?
>
> require('./includes/config.inc.php');
>
> #// ################################################
> #// Is the user logged in?
>
> if(isset($_SESSION["LMS_LOGGED_IN"])){
> * * * * $_SESSION["REDIRECT_AFTER_LOGIN"] = "current_sightings.php";
> * * * * Header("Location: user_login.php");
> * * * * exit;
>
> }
>
> include $include_path."LMS_functions.inc.php";
>
> switch($param){
> * case 'current_sightings':
> * * * * * $result =
> SELECT_sightings_leasecars($id,CLM_order_by($order _by));
> * * * * * break;
> * /*case 'cars_by_location':
> * * * $result = GetCars($lease_id);
> * * * break;
> * case 'idle_cars':
> * * * * * $result = GetRest($lease_id);
> * * * * * break;
> * case 'bad_order':
> * * * $result = GetRest($lease_id);
> * * * break;*/
> * default:
> * * * * $result = SELECT_sightings_leasecars($id,CLM_order_by($order _by));
> * * * * break;
> * }
>
> if(!$result){
> * * MySQLError($query);
> * * exit;
>
> }
>
> $fields = mysql_num_fields($result);
>
> for ($i = 0; $i < $fields; $i++) {
> * * $header .= mysql_field_name($result, $i) . "\t";
>
> }
>
> while($row = mysql_fetch_row($result)) {
> * * $line = '';
> * * foreach($row as $value)
> {
> * * * * if ((!isset($value)) OR ($value == "")) {
> * * * * * * $value = "\t";
> * * * * } else {
> * * * * * * $value = str_replace('"', '""', $value);
> * * * * * * $value = '"' . $value . '"' . "\t";
> * * * * }
> * * * * $line .= $value;
> * * }
> * * $data .= trim($line)."\n";}
>
> $data = str_replace("\r","",$data);
>
> if ($data == "") {
> * * $data = "\n(0) Records Found!\n";
>
> }
>
> //$filename = GetFilename($lease_id)."_".$param;
> $filename = "Current Sightings ";
>
> header("Content-type: application/x-msdownload");
> header("Content-Disposition: attachment; filename=".$filename.".xls");
> header("Pragma: no-cache");
> header("Expires: 0");
> print "$header\n$data";
>
> ################################################## #########################*###################
> ################################################## #########################*###################
> #######
> ####### * * * * * * * * * * * * * * * * * * * * QUERY FUNCTIONS
> #######
> ################################################## #########################*###################
> ################################################## #########################*###################
> function SELECT_sightings_leasecars($lease_id,$order_by) {
> * $query = "SELECT c.l_e,
> * * * * * * * * * * * * * * * * * *c.car_mark, c.car_number,
> * * * * * * * * * * * * * * * * * *c.location_city, c.location_state,
> * * * * * * * * * * * * * * * * * *c.sighting_date,
> * * * * * * * * * * * * * * * * * *e.classification,
> * * * * * * * * * * * * * * * * * *c.railroad,
> * * * * * * * * * * * * * * * * * *s.city as origin_city,
> * * * * * * * * * * * * * * * * * *s.state as origin_state,
> * * * * * * * * * * * * * * * * * *c.destination_city, c.destination_state,
> * * * * * * * * * * * * * * * * * *t.eta
> * * * * * * * * * * * * FROM INTERNAL_REMARK r, INTERNAL_CAR_LEASE cl,
> clm_lastsighting_view v1,
> * * * * * * * * * * * * * * * * *clm_crossreference_view v2, INTERNAL_CODES e, INTERNAL_CLM c
> * * * * * * * * * * * * LEFT JOIN (INTERNAL_TRIPSt, INTERNAL_SPLC s)
> * * * * * * * * * * * * * * * * *ON (c.trip_id = t.trip_id
> * * * * * * * * * * * * * * * * *AND t.origin_splc_id = s.splc_id)
> * * * * * * * * * * * * WHERE cl.lease_id = ".$lease_id."
> * * * * * * * * * * * * AND cl.end_date IS NULL
> * * * * * * * * * * * * AND cl.remark_id = r.remark_id
> * * * * * * * * * * * * AND r.car_mark = c.car_mark
> * * * * * * * * * * * * AND c.car_mark = v1.car_mark
> * * * * * * * * * * * * AND v1.car_mark = v2.car_mark
> * * * * * * * * * * * * AND r.car_number = c.car_number
> * * * * * * * * * * * * AND c.car_number = v1.car_number
> * * * * * * * * * * * * AND v1.car_number = v2.car_number
> * * * * * * * * * * * * AND c.sighting_date = v1.sighting_date
> * * * * * * * * * * * * AND c.sighting_code = v2.code
> * * * * * * * * * * * * AND c.sighting_code = e..code
> * * * * * * * * * * * * ORDER BY ".$order_by;
> * $result = mysql_query($query);
> * if(!$result) {
> * * MySQLError($query);
> * * exit;
> * }
> * return $result;
>
> }
>
> ?>- Hide quoted text -
>
> - Show quoted text -


As I have said before, I am not a php guru to find your mistake here,
but if it was me I would break this down. Write a php that does the
excel part 1st, make sure it works. Then integrate it into the rest of
the program.

Bill H
Reply With Quote
  #16 (permalink)  
Old 07-20-2008
Jerry Stuckle
 
Posts: n/a
Default Re: can't redirect to Excel

JRough wrote:
> On Jul 19, 12:41 am, "Paul Lautman" <paul.laut...@btinternet.com>
> wrote:
>> JRough wrote:
>>> I have tried this 4 2 weeks and I need some help. There are 3 other
>>> pages referenced on this page but I'm going to start with this page
>>> in case I missed something. It is called current_sightings.php. All
>>> I want to do is redirect to Excel in the case of the External user.
>>> The first if statement creates a form. The elseif redirects the
>>> external user to only his own listings. I want the results for the
>>> Internal user query SELECT_sightings_leasecars.() to go to my
>>> current_sightingsXL.php page. Where/How would I put the redirect? I
>>> think it should be after the switch for external users. The
>>> getTableHeaders() function is the string that gets passed. All the
>>> pages work except I can't redirect the output to Excel.

>> What do you mean by "redirect the output to Excel"??? Excel isn't a
>> location, it's a spreadsheet program that some (but not all users) will have
>> on their machine.

> I have a fully qualified url and it still doesn't work. I'm not sure
> I put the if/else redirect to the Excel output right? It is going to
> the Excel page but I get this message. These users will have Excel
> since it is their cars and they want it in Excel. Do I have the if/
> else in the right place?
>
>
> Warning: session_start() [function.session-start]: Cannot send session
> cache limiter - headers already sent (output started at /home/dhandler/
> public_html/fakerockridge/current_sightingsXL.php:2) in /home/dhandler/
> public_html/fakerockridge/includes/config.inc.php on line 18
>
> Warning: Cannot modify header information - headers already sent by
> (output started at /home/dhandler/public_html/fakerockridge/
> current_sightingsXL.php:2) in /home/dhandler/public_html/fakerockridge/
> current_sightingsXL.php on line 20
>
>

<code snipped>

The first message indicates you have output something to the client
before the call to session_start() (you can't do it before calling
header(), either).

The second message indicates the file and line in that file where the
output was sent.

This can be anything which is sent to the browser - including white
space, i.e. a nl character after the ?>. Or anything else.



--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
  #17 (permalink)  
Old 07-20-2008
JRough
 
Posts: n/a
Default Re: can't redirect to Excel

On Jul 19, 3:59 pm, Bill H <b...@ts1000.us> wrote:
> On Jul 19, 5:15 pm, JRough <jlro...@yahoo.com> wrote:
>
>
>
> > On Jul 19, 12:41 am, "Paul Lautman" <paul.laut...@btinternet.com>
> > wrote:

>
> > > JRough wrote:
> > > >I have tried this 4 2 weeks and I need some help. There are 3 other
> > > > pages referenced on this page but I'm going to start with this page
> > > > in case I missed something. It is called current_sightings.php. All
> > > > I want to do is redirect to Excel in the case of the External user.
> > > > The first if statement creates a form. The elseif redirects the
> > > > external user to only his own listings. I want the results for the
> > > > Internal user query SELECT_sightings_leasecars.() to go to my
> > > > current_sightingsXL.php page. Where/How would I put the redirect? I
> > > > think it should be after the switch for external users. The
> > > > getTableHeaders() function is the string that gets passed. All the
> > > > pages work except I can't redirect the output to Excel.

>
> > > What do you mean by "redirect the output to Excel"??? Excel isn't a
> > > location, it's a spreadsheet program that some (but not all users) will have
> > > on their machine.

>
> > I have a fully qualified url and it still doesn't work. I'm not sure
> > I put the if/else redirect to the Excel output right? It is going to
> > the Excel page but I get this message. These users will have Excel
> > since it is their cars and they want it in Excel. Do I have the if/
> > else in the right place?

>
> > Warning: session_start() [function.session-start]: Cannot send session
> > cache limiter - headers already sent (output started at /home/dhandler/
> > public_html/fakerockridge/current_sightingsXL.php:2) in /home/dhandler/
> > public_html/fakerockridge/includes/config.inc.php on line 18

>
> > Warning: Cannot modify header information - headers already sent by
> > (output started at /home/dhandler/public_html/fakerockridge/
> > current_sightingsXL.php:2) in /home/dhandler/public_html/fakerockridge/
> > current_sightingsXL.php on line 20

>
> > On line 20 of current_sightingsXL.php it is the user login
> > Header("Location: user_login.php");
> > 21 exit;

>
> > Does that mean it dosn't know I am an internal user?

>
> > thanks, for any help you can provide.
> > Janis
> > ---------current_sightings.php----------
> > <?

>
> > include './includes/config.inc.php';
> > include $include_path.'dates.inc.php';
> > include $include_path."LMS_functions.inc.php";

>
> > ################################################
> > //Is the user logged in?
> > Validate_login("current_sightings.php");

>
> > if(empty($id)&&($_SESSION["LMS_USER_DESC"]=='internal')){
> > # THIS IS id INSTEAD OF lease_id B/C ONE DAY WE MIGHT HAVE CUSTOMER
> > SUB GROUPS OR MANAGED CARS
> > $destroyed = GetDestroyed_lease_id();
> > $result = SELECT_leasesCLM();
> > $TPL_ids = "<SELECT name='id' class=box size=8>\n";
> > $trbg = "";

>
> > while($row = mysql_fetch_assoc($result)){
> > $id = $row['lease_id'];
> > $lnum = $row['lease_num'];
> > $comp = $row['comp_name'];

>
> > $trbg = GetTRBG($trbg);

>
> > $TPL_ids.=" <OPTION VALUE='".$id;
> > $TPL_ids.="' ".$trbg.">".$lnum." - ".$comp."</OPTION>\n";

>
> > }

>
> > $TPL_ids.="</SELECT>\n";
> > include "header.php";
> > include $template_path."current_sightings_php.html";

>
> > }elseif($_POST['assign']=='Open in Excel'){

>
> > Header("Location:http://www.allcapitalrailmanagement.com/fakerockridge/current_sightin...".$_Post['lease_num']."&id=".$lnum);

>
> > }elseif($_POST['redirect']&&$_POST['redirect']!=$_SERVER['PHP_SELF']){

>
> > Header("Location: ".$_POST['redirect'].".php?id=".$_POST['id']);
> > exit;

>
> > }else{

>
> > # DETERMINE PAGE ACCORDING TO USER TYPE
> > switch ($_SESSION["LMS_USER_DESC"]){
> > case "customer":
> > $id = $_SESSION["LMS_LOGGED_IN"];
> > $MSG_carlist = "CURRENT SIGHTINGS";
> > $result = SELECT_sightings_customercars($id,CLM_order_by($or der_by));
> > break;
> > case "internal":
> > $MSG_carlist = "CURRENT SIGHTINGS FOR ".SELECT_lease_num($id)."
> > ".SELECT_comp_name($id);
> > $result = SELECT_sightings_leasecars($id,CLM_order_by($order _by));
> > break;
> > #case "internal_ltd":
> > # break;}

>
> > $TPL_carnumbers = GetTableHeaders($id);
> > while ($row = mysql_fetch_assoc($result)){
> > $TPL_carnumbers.=MakeSighting($row);

>
> > }

>
> > $TPL_carnumbers.="</table>";

>
> > include "header.php";
> > include $template_path."template_carlist.html";

>
> > }

>
> > ?>
> > -----------

>
> > On line 18 in the config file it is simply session_start()

>
> > What could this mean?

>
> > thanks,

>
> > ---------------current_sightingsXL.php-------------------

>
> > <?

>
> > require('./includes/config.inc.php');

>
> > #// ################################################
> > #// Is the user logged in?

>
> > if(isset($_SESSION["LMS_LOGGED_IN"])){
> > $_SESSION["REDIRECT_AFTER_LOGIN"] = "current_sightings.php";
> > Header("Location: user_login.php");
> > exit;

>
> > }

>
> > include $include_path."LMS_functions.inc.php";

>
> > switch($param){
> > case 'current_sightings':
> > $result =
> > SELECT_sightings_leasecars($id,CLM_order_by($order _by));
> > break;
> > /*case 'cars_by_location':
> > $result = GetCars($lease_id);
> > break;
> > case 'idle_cars':
> > $result = GetRest($lease_id);
> > break;
> > case 'bad_order':
> > $result = GetRest($lease_id);
> > break;*/
> > default:
> > $result = SELECT_sightings_leasecars($id,CLM_order_by($order _by));
> > break;
> > }

>
> > if(!$result){
> > MySQLError($query);
> > exit;

>
> > }

>
> > $fields = mysql_num_fields($result);

>
> > for ($i = 0; $i < $fields; $i++) {
> > $header .= mysql_field_name($result, $i) . "\t";

>
> > }

>
> > while($row = mysql_fetch_row($result)) {
> > $line = '';
> > foreach($row as $value)
> > {
> > if ((!isset($value)) OR ($value == "")) {
> > $value = "\t";
> > } else {
> > $value = str_replace('"', '""', $value);
> > $value = '"' . $value . '"' . "\t";
> > }
> > $line .= $value;
> > }
> > $data .= trim($line)."\n";}

>
> > $data = str_replace("\r","",$data);

>
> > if ($data == "") {
> > $data = "\n(0) Records Found!\n";

>
> > }

>
> > //$filename = GetFilename($lease_id)."_".$param;
> > $filename = "Current Sightings ";

>
> > header("Content-type: application/x-msdownload");
> > header("Content-Disposition: attachment; filename=".$filename.".xls");
> > header("Pragma: no-cache");
> > header("Expires: 0");
> > print "$header\n$data";

>
> > ################################################## #########################*###################
> > ################################################## #########################*###################
> > #######
> > ####### QUERY FUNCTIONS
> > #######
> > ################################################## #########################*###################
> > ################################################## #########################*###################
> > function SELECT_sightings_leasecars($lease_id,$order_by) {
> > $query = "SELECT c.l_e,
> > c.car_mark, c.car_number,
> > c.location_city, c.location_state,
> > c.sighting_date,
> > e.classification,
> > c.railroad,
> > s.city as origin_city,
> > s.state as origin_state,
> > c.destination_city, c.destination_state,
> > t.eta
> > FROM INTERNAL_REMARK r, INTERNAL_CAR_LEASE cl,
> > clm_lastsighting_view v1,
> > clm_crossreference_view v2, INTERNAL_CODES e, INTERNAL_CLM c
> > LEFT JOIN (INTERNAL_TRIPS t, INTERNAL_SPLC s)
> > ON (c.trip_id = t.trip_id
> > AND t.origin_splc_id = s.splc_id)
> > WHERE cl.lease_id = ".$lease_id."
> > AND cl.end_date IS NULL
> > AND cl.remark_id = r.remark_id
> > AND r.car_mark = c.car_mark
> > AND c.car_mark = v1.car_mark
> > AND v1.car_mark = v2.car_mark
> > AND r.car_number = c.car_number
> > AND c.car_number = v1.car_number
> > AND v1.car_number = v2.car_number
> > AND c.sighting_date = v1.sighting_date
> > AND c.sighting_code = v2.code
> > AND c.sighting_code = e.code
> > ORDER BY ".$order_by;
> > $result = mysql_query($query);
> > if(!$result) {
> > MySQLError($query);
> > exit;
> > }
> > return $result;

>
> > }

>
> > ?>- Hide quoted text -

>
> > - Show quoted text -

>
> As I have said before, I am not a php guru to find your mistake here,
> but if it was me I would break this down. Write a php that does the
> excel part 1st, make sure it works. Then integrate it into the rest of
> the program.
>
> Bill H

I couldn't get the internal side to work so I tried the external which
is easier. Just a URL to click and capture the input into excel. I
have to get soemthign working. Next time I will try to get more of
an outline.I might be able to use your PERL script here but I don't
understand it.

I wrote this and it works sort of. Well the image is transparent and
inside the button it looks like the data. Now I would just like to
make it click and go into Excel.

<img src="<?=$SETTINGS['siteurl']?>images/transparent.gif" width= "20"
height="10">
<?=strtoupper($MSG_carlist)?>
Reply With Quote
  #18 (permalink)  
Old 07-20-2008
JRough
 
Posts: n/a
Default Re: can't redirect to Excel

On Jul 19, 5:30 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> JRough wrote:
> > On Jul 19, 12:41 am, "Paul Lautman" <paul.laut...@btinternet.com>
> > wrote:
> >> JRough wrote:
> >>> I have tried this 4 2 weeks and I need some help. There are 3 other
> >>> pages referenced on this page but I'm going to start with this page
> >>> in case I missed something. It is called current_sightings.php. All
> >>> I want to do is redirect to Excel in the case of the External user.
> >>> The first if statement creates a form. The elseif redirects the
> >>> external user to only his own listings. I want the results for the
> >>> Internal user query SELECT_sightings_leasecars.() to go to my
> >>> current_sightingsXL.php page. Where/How would I put the redirect? I
> >>> think it should be after the switch for external users. The
> >>> getTableHeaders() function is the string that gets passed. All the
> >>> pages work except I can't redirect the output to Excel.
> >> What do you mean by "redirect the output to Excel"??? Excel isn't a
> >> location, it's a spreadsheet program that some (but not all users) will have
> >> on their machine.

> > I have a fully qualified url and it still doesn't work. I'm not sure
> > I put the if/else redirect to the Excel output right? It is going to
> > the Excel page but I get this message. These users will have Excel
> > since it is their cars and they want it in Excel. Do I have the if/
> > else in the right place?

>
> > Warning: session_start() [function.session-start]: Cannot send session
> > cache limiter - headers already sent (output started at /home/dhandler/
> > public_html/fakerockridge/current_sightingsXL.php:2) in /home/dhandler/
> > public_html/fakerockridge/includes/config.inc.php on line 18

>
> > Warning: Cannot modify header information - headers already sent by
> > (output started at /home/dhandler/public_html/fakerockridge/
> > current_sightingsXL.php:2) in /home/dhandler/public_html/fakerockridge/
> > current_sightingsXL.php on line 20

>
> <code snipped>
>
> The first message indicates you have output something to the client
> before the call to session_start() (you can't do it before calling
> header(), either).
>
> The second message indicates the file and line in that file where the
> output was sent.
>
> This can be anything which is sent to the browser - including white
> space, i.e. a nl character after the ?>. Or anything else.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

Thanks,
Yes I discovered that. I ended up taking the else if out and I am
back where I started this morning. I don't know where to put the
redirect to Excel :-)
I think it is because it has to get the output first from the string
and the header. I don't know. I blocked it out. It probably goes at
the end after the header but I may be missing something else like the
string to output.
Janis

<?


include './includes/config.inc.php';
include $include_path.'dates.inc.php';
include $include_path."LMS_functions.inc.php";

################################################
//Is the user logged in?
Validate_login("current_sightings.php");

if(empty($id)&&($_SESSION["LMS_USER_DESC"]=='internal')){
# THIS IS id INSTEAD OF lease_id B/C ONE DAY WE MIGHT HAVE CUSTOMER
SUB GROUPS OR MANAGED CARS
$destroyed = GetDestroyed_lease_id();
$result = SELECT_leasesCLM();
$TPL_ids = "<SELECT name='id' class=box size=8>\n";
$trbg = "";

while($row = mysql_fetch_assoc($result)){
$id = $row['lease_id'];
$lnum = $row['lease_num'];
$comp = $row['comp_name'];

$trbg = GetTRBG($trbg);

$TPL_ids.=" <OPTION VALUE='".$id;
$TPL_ids.="' ".$trbg.">".$lnum." - ".$comp."</OPTION>\n";
}

$TPL_ids.="</SELECT>\n";
include "header.php";
include $template_path."current_sightings_php.html";
include "footer.php";
}elseif($_POST['redirect']&&$_POST['redirect']!=$_SERVER['PHP_SELF']){
Header("Location: ".$_POST['redirect'].".php?id=".$_POST['id']);
exit;

/*}elseif($_POST['assign']=='Open in Excel'){
Header("Location: current_sightingsXL.php?param=".
$_Post['lease_id']."&lease_id=".$_lease_id);*/

}else{

# DETERMINE PAGE ACCORDING TO USER TYPE
switch ($_SESSION["LMS_USER_DESC"]){
case "customer":
$id = $_SESSION["LMS_LOGGED_IN"];
$MSG_carlist = "CURRENT SIGHTINGS";
$result = SELECT_sightings_customercars($id,CLM_order_by($or der_by));

break;
case "internal":
$MSG_carlist = "CURRENT SIGHTINGS FOR ".SELECT_lease_num($id)."
".SELECT_comp_name($id);
$result = SELECT_sightings_leasecars($id,CLM_order_by($order _by));

break;
#case "internal_ltd":
# break;
}

$TPL_carnumbers = GetTableHeaders($id);
while ($row = mysql_fetch_assoc($result)){
$TPL_carnumbers.=MakeSighting($row);
}

$TPL_carnumbers.="</table>";
include "header.php";
include $template_path."template_carlist.html";


}



include "footer.php";
Reply With Quote
  #19 (permalink)  
Old 07-20-2008
Jerry Stuckle
 
Posts: n/a
Default Re: can't redirect to Excel

JRough wrote:
> On Jul 19, 5:30 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> JRough wrote:
>>> On Jul 19, 12:41 am, "Paul Lautman" <paul.laut...@btinternet.com>
>>> wrote:
>>>> JRough wrote:
>>>>> I have tried this 4 2 weeks and I need some help. There are 3 other
>>>>> pages referenced on this page but I'm going to start with this page
>>>>> in case I missed something. It is called current_sightings.php. All
>>>>> I want to do is redirect to Excel in the case of the External user.
>>>>> The first if statement creates a form. The elseif redirects the
>>>>> external user to only his own listings. I want the results for the
>>>>> Internal user query SELECT_sightings_leasecars.() to go to my
>>>>> current_sightingsXL.php page. Where/How would I put the redirect? I
>>>>> think it should be after the switch for external users. The
>>>>> getTableHeaders() function is the string that gets passed. All the
>>>>> pages work except I can't redirect the output to Excel.
>>>> What do you mean by "redirect the output to Excel"??? Excel isn't a
>>>> location, it's a spreadsheet program that some (but not all users) will have
>>>> on their machine.
>>> I have a fully qualified url and it still doesn't work. I'm not sure
>>> I put the if/else redirect to the Excel output right? It is going to
>>> the Excel page but I get this message. These users will have Excel
>>> since it is their cars and they want it in Excel. Do I have the if/
>>> else in the right place?
>>> Warning: session_start() [function.session-start]: Cannot send session
>>> cache limiter - headers already sent (output started at /home/dhandler/
>>> public_html/fakerockridge/current_sightingsXL.php:2) in /home/dhandler/
>>> public_html/fakerockridge/includes/config.inc.php on line 18
>>> Warning: Cannot modify header information - headers already sent by
>>> (output started at /home/dhandler/public_html/fakerockridge/
>>> current_sightingsXL.php:2) in /home/dhandler/public_html/fakerockridge/
>>> current_sightingsXL.php on line 20

>> <code snipped>
>>
>> The first message indicates you have output something to the client
>> before the call to session_start() (you can't do it before calling
>> header(), either).
>>
>> The second message indicates the file and line in that file where the
>> output was sent.
>>
>> This can be anything which is sent to the browser - including white
>> space, i.e. a nl character after the ?>. Or anything else.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================

> Thanks,
> Yes I discovered that. I ended up taking the else if out and I am
> back where I started this morning. I don't know where to put the
> redirect to Excel :-)
> I think it is because it has to get the output first from the string
> and the header. I don't know. I blocked it out. It probably goes at
> the end after the header but I may be missing something else like the
> string to output.
> Janis
>
> <?
>


It had nothing to do with the else if. It had to do with sending output
when you shouldn't.

Did you look at the file and line? What are you outputting there?
That's your problem with the messages.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
  #20 (permalink)  
Old 07-20-2008
JRough
 
Posts: n/a
Default Re: can't redirect to Excel

On Jul 19, 6:13 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> JRough wrote:
> > On Jul 19, 5:30 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> >> JRough wrote:
> >>> On Jul 19, 12:41 am, "Paul Lautman" <paul.laut...@btinternet.com>
> >>> wrote:
> >>>> JRough wrote:
> >>>>> I have tried this 4 2 weeks and I need some help. There are 3 other
> >>>>> pages referenced on this page but I'm going to start with this page
> >>>>> in case I missed something. It is called current_sightings.php. All
> >>>>> I want to do is redirect to Excel in the case of the External user.
> >>>>> The first if statement creates a form. The elseif redirects the
> >>>>> external user to only his own listings. I want the results for the
> >>>>> Internal user query SELECT_sightings_leasecars.() to go to my
> >>>>> current_sightingsXL.php page. Where/How would I put the redirect? I
> >>>>> think it should be after the switch for external users. The
> >>>>> getTableHeaders() function is the string that gets passed. All the
> >>>>> pages work except I can't redirect the output to Excel.
> >>>> What do you mean by "redirect the output to Excel"??? Excel isn't a
> >>>> location, it's a spreadsheet program that some (but not all users) will have
> >>>> on their machine.
> >>> I have a fully qualified url and it still doesn't work. I'm not sure
> >>> I put the if/else redirect to the Excel output right? It is going to
> >>> the Excel page but I get this message. These users will have Excel
> >>> since it is their cars and they want it in Excel. Do I have the if/
> >>> else in the right place?
> >>> Warning: session_start() [function.session-start]: Cannot send session
> >>> cache limiter - headers already sent (output started at /home/dhandler/
> >>> public_html/fakerockridge/current_sightingsXL.php:2) in /home/dhandler/
> >>> public_html/fakerockridge/includes/config.inc.php on line 18
> >>> Warning: Cannot modify header information - headers already sent by
> >>> (output started at /home/dhandler/public_html/fakerockridge/
> >>> current_sightingsXL.php:2) in /home/dhandler/public_html/fakerockridge/
> >>> current_sightingsXL.php on line 20
> >> <code snipped>

>
> >> The first message indicates you have output something to the client
> >> before the call to session_start() (you can't do it before calling
> >> header(), either).

>
> >> The second message indicates the file and line in that file where the
> >> output was sent.

>
> >> This can be anything which is sent to the browser - including white
> >> space, i.e. a nl character after the ?>. Or anything else.

>
> >> --
> >> ==================
> >> Remove the "x" from my email address
> >> Jerry Stuckle
> >> JDS Computer Training Corp.
> >> jstuck...@attglobal.net
> >> ==================

> > Thanks,
> > Yes I discovered that. I ended up taking the else if out and I am
> > back where I started this morning. I don't know where to put the
> > redirect to Excel :-)
> > I think it is because it has to get the output first from the string
> > and the header. I don't know. I blocked it out. It probably goes at
> > the end after the header but I may be missing something else like the
> > string to output.
> > Janis

>
> > <?

>
> It had nothing to do with the else if. It had to do with sending output
> when you shouldn't.
>
> Did you look at the file and line? What are you outputting there?
> That's your problem with the messages.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

have the else/if blocked.
So I still need to know where to put it, however, I do believe there
is somehting missing regarding the output string.
The $data
thanks,
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules