|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I'm beginning to think I'm the queen of it worked before ... I used
this exact same page on another website I did. It worked beautifully. On my site, it doesn't work. Instead of opening in excel I get: All of my data and ... Warning: Cannot modify header information - headers already sent by (output started at /home/smith/public_html/addressbook/ab_print.php:6) in /home/smith/public_html/addressbook/ab_print.php on line 70 Warning: Cannot modify header information - headers already sent by (output started at /home/smith/public_html/addressbook/ab_print.php:6) in /home/smith/public_html/addressbook/ab_print.php on line 71 Warning: Cannot modify header information - headers already sent by (output started at /home/smith/public_html/addressbook/ab_print.php:6) in /home/smith/public_html/addressbook/ab_print.php on line 72 Warning: Cannot modify header information - headers already sent by (output started at /home/smith/public_html/addressbook/ab_print.php:6) in /home/smith/public_html/addressbook/ab_print.php on line 73 <HTML> <HEAD> </HEAD> <BODY> <?PHP include("../includes/connect.txt"); ?> <?PHP $sql = "SELECT * FROM $db_table4 ORDER BY category ASC, business ASC, lastName ASC, firstName ASC"; $result = mysql_query ($sql, $connect) or die ('Query failed: ' .mysql_error()); echo "<TABLE CELLSPACING='2' CELLPADDING='2' BORDER='1'>"; echo "<TR>"; echo "<TD CLASS='title'>Category</TD>"; echo "<TD CLASS='title'>Business</TD>"; echo "<TD CLASS='title'>Name</TD>"; echo "<TD CLASS='title'>Address</TD>"; echo "<TD CLASS='title'>Address</TD>"; echo "<TD CLASS='title'>City</TD>"; echo "<TD CLASS='title'>State</TD>"; echo "<TD CLASS='title'>Zip</TD>"; echo "<TD CLASS='title'>Phone</TD>"; echo "<TD CLASS='title'>Cell</TD>"; echo "<TD CLASS='title'>Email</TD>"; echo "<TD CLASS='title'>Alternate Email</TD>"; echo "<TD CLASS='title'>AIM</TD>"; echo "<TD CLASS='title'>Notes</TD>"; echo "</TR>"; while ($row = mysql_fetch_array ($result)) { echo "<TR>"; $business = $row['business']; $lastName = $row['lastName']; $firstName = $row['firstName']; $category = $row['category']; $telephone = $row['telephone']; $area = substr($telephone,0,3); $exchange = substr($telephone,3,3); $rest = substr($telephone,6,4); $cellphone = $row['cellphone']; $areac = substr($cellphone,0,3); $exchangec = substr($cellphone,3,3); $restc = substr($cellphone,6,4); $address1 = $row['address1']; $address2 = $row['address2']; $city = $row['city']; $state = $row['state']; $zip = $row['zipcode']; $email1 = $row['email1']; $$email2 = $row['$email2']; $aimid = $row['aimid']; $url = $row['url']; $notes = $row['notes']; echo "<TD>$category</TD>"; echo "<TD>$business</TD>"; echo "<TD>$lastName, $firstName</TD>"; echo "<TD>$address1</TD>"; echo "<TD>$address2</TD>"; echo "<TD>$city</TD>"; echo "<TD>$state</TD>"; echo "<TD>$zip</TD>"; echo "<TD>($area) $exchange-$rest</TD>"; echo "<TD>($areac) $exchangec-$restc</TD>"; echo "<TD>$email1</TD>"; echo "<TD>$email2</TD>"; echo "<TD>$aimid</TD>"; echo "<TD>$notes</TD>"; echo "</TR>"; } echo "</TABLE>"; header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=addressbook.xls"); header("Pragma: no-cache"); header("Expires: 0"); ?> </BODY> </HTML> |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Fri, 20 Jul 2007 22:07:25 +0200, gagal <lynettesmith@gmail.com> wrote:
> I'm beginning to think I'm the queen of it worked before ... I used > this exact same page on another website I did. It worked > beautifully. On my site, it doesn't work. Instead of opening in > excel I get: > Warning: Cannot modify header information - headers already sent by > (output started at /home/smith/public_html/addressbook/ab_print.php:6) > in /home/smith/public_html/addressbook/ab_print.php on line 70 > > <?PHP include("../includes/connect.txt"); ?> > <?PHP > $sql = "SELECT * FROM $db_table4 ORDER BY category ASC, business ASC, .......... > echo "</TABLE>"; > header("Content-type: application/octet-stream"); > header("Content-Disposition: attachment; filename=addressbook.xls"); > header("Pragma: no-cache"); > header("Expires: 0"); > ?> Well, on the other server there's obviously some outbut buffering on. Just move all of your header() statements up and run them first before all other output or content. -- Rik Wasmus |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Jul 20, 4:20 pm, Rik <luiheidsgoe...@hotmail.com> wrote:
> On Fri, 20 Jul 2007 22:07:25 +0200, gagal <lynettesm...@gmail.com> wrote: > > I'm beginning to think I'm the queen of it worked before ... I used > > this exact same page on another website I did. It worked > > beautifully. On my site, it doesn't work. Instead of opening in > > excel I get: > > Warning: Cannot modify header information - headers already sent by > > (output started at /home/smith/public_html/addressbook/ab_print.php:6) > > in /home/smith/public_html/addressbook/ab_print.php on line 70 > > > <?PHP include("../includes/connect.txt"); ?> > > <?PHP > > $sql = "SELECT * FROM $db_table4 ORDER BY category ASC, business ASC, > ......... > > echo "</TABLE>"; > > header("Content-type: application/octet-stream"); > > header("Content-Disposition: attachment; filename=addressbook.xls"); > > header("Pragma: no-cache"); > > header("Expires: 0"); > > ?> > > Well, on the other server there's obviously some outbut buffering on. Just > move all of your header() statements up and run them first before all > other output or content. > -- > Rik Wasmus The problem could also be that display_errors is disabled on the server. In any event, Rik's solution should work. |
|
![]() |
| Outils de la discussion | |
|
|