php-general Digest 10 Jan 2004 10:26:23 -0000 Issue 2522

Topics (messages 174179 through 174196):

Re: Display syslog file?
        174179 by: Steve Edberg

Re: XML/HTML encoding?
        174180 by: memoimyself.yahoo.com.br

Hiding files away from /public_html/
        174181 by: Philip J. Newman
        174183 by: Ralph Guzman

Re: Buffalo'ed, stumped, confused...
        174182 by: Ralph Guzman

Re: post vars not by form
        174184 by: Ralph Guzman

Re: Not working?
        174185 by: Ralph Guzman

Re: Sorting data into columns vertically
        174186 by: Ralph Guzman
        174187 by: Ralph Guzman
        174188 by: Ralph Guzman

Re: limit mysql connections
        174189 by: John W. Holmes

[Newbie Guide] For the benefit of new members
        174190 by: Ma Siva Kumar

Total NewB Q
        174191 by: Russell Shaw

Odd strtotime behavior
        174192 by: Chris W
        174193 by: hitek

writing Excel files through PHP
        174194 by: Binay

Rand() problem
        174195 by: nefar
        174196 by: Richard Davey

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message --- I don't know if the same syntax is available on Linux, but on Solaris I can use the 'tail -f' command to watch lines being appended to a file from the commandline.. You might be able to do something via

passthru("tail -f $PathToSyslog");

in a frame on your page...although there might be socket_blocking or page flush() issues to experiment with -

steve

At 8:28 AM -0600 1/9/04, Carlton L. Whitmore wrote:
I didn't make my last request very clear. I used lastlog as an example,
but what I really want to do is open a syslog file (text file), that is
coming in from a VPN box.
I'd like to have it displayed live so I can scan it during the day.
What is the best way to do this? Someone had suggested using cron, but
I'm very new to Linux and PHP so I would need some help with that.
Any help is appreciated,
Carlton.



--
+------------------------------------------------------------------------+
| Steve Edberg                                      [EMAIL PROTECTED] |
| University of California, Davis                          (530)754-9127 |
| Programming/Database/SysAdmin               http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| [EMAIL PROTECTED]: 1001 Work units on 23 oct 2002                              |
| 3.152 years CPU time, 3.142 years SETI user... and STILL no aliens...  |
+------------------------------------------------------------------------+

--- End Message ---
--- Begin Message ---
Hello Vincent,

On 9 Jan 2004 at 16:23, Vincent Jansen wrote:

> After xslt I end up with a html document with a souce that looks
> something like
> 
>       <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>       <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
>       "http://www.w3.org/TR/REC-html40/loose.dtd";>
>       <html>
>       <head>
>               <title>dotted e (ë) works</title>
>       </head>
>       <body>
>       Etc.....
> 
> This is what I want
> But my browser displays "dotted e () works"
> 
> Because I don't want yes or no: Please tell me what (maybe obvious
> thing) I'm doing wrong

I don't think you're doing anything wrong, except perhaps for using an outdated 
browser. 
The "ë" (e-umlaut, which you called a "dotted e") displays just fine in both IE 6 and 
Netscape 7.1 on my computer.

Make sure your browser is configured to use Western European (ISO-8859-1) encoding, 
because even latest-generation browsers have poor support for UTF-8. To change your 
browser's encoding settings, do:

In IE 6: View > Encoding

In Netscape: View > Character Coding

Any other browser: figure it out yourself ;-)

Take care,

Erik

--- End Message ---
--- Begin Message ---
Hi, just wanted to pick someones brain.

I want to store some images outside the /public_html/ how ever my isp has decided that 
i'm not aloud
to write files in that area.  Would the next best solution that wold be as secure to 
maybe put them
in a folder with a .htaccess file in it?

---
Philip J. Newman
Master Developer
PhilipNZ.com [NZ] Ltd.
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Put them in a folder with .htaccess:

RewriteEngine onRewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/.*$     [NC]
ReWriteRule .*\.(gif|jpg)$      -       [N,F,L]



-----Original Message-----
From: Philip J. Newman [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 3:42 PM
To: 'Php-general'
Subject: [PHP] Hiding files away from /public_html/

Hi, just wanted to pick someones brain.

I want to store some images outside the /public_html/ how ever my isp has
decided that i'm not aloud
to write files in that area.  Would the next best solution that wold be as
secure to maybe put them
in a folder with a .htaccess file in it?

---
Philip J. Newman
Master Developer
PhilipNZ.com [NZ] Ltd.
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
For debugging purposes, if you want to see all values in $_POST use this
code:

print '<pre>';
print_r($_POST);
print '</pre>';

or this:

print '<pre>';
var_dump($_POST);
print '</pre>';

-----Original Message-----
From: Robin Kopetzky [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 4:31 PM
To: PHP General
Subject: [PHP] Buffalo'ed, stumped, confused...

Good evening.

I'm trying to read using $_POST, 4 radio buttons named "miles". I tried
reading the selected value with $_POST['miles[0]'], etc. with no success.
I've even tried using foreach to read the selected radio button with no
success.

Help!! I'm totally stumped with this one. I thought the value was passed
back as an array but maybe I'm wrong...

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Use socket connection:

http://www.php.net/fsockopen

read the "User Contributed Notes" where you will find functions and
examples.

-----Original Message-----
From: Nabil [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 2:07 PM
To: [EMAIL PROTECTED]
Subject: [PHP] post vars not by form

HI,
Anyone can help , how to post variables from server side .. as from php page
to other without HTML form and submistion ???

i want post method , to post my vars to another php on another server , then
i have to read the body that will be printed by fopen ... so i can not use
Location:
example :
i wwant to post to www.example.com?var=1&var2=2
and then read the the body from that link .. as 1 or 0   ..

Regards

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Or this:

system("rename('/path/to/new.sh', '/path/to/old' . $today)");

-----Original Message-----
From: Matt Grimm [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 10:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Not working?

You can't use variables inside single quotes, either.

This:
'/path/to/old.$today'
ought to be:
"/path/to/old.$today"

--
Matt Grimm


"Jas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I think I must be missing something but this command isn't renaming the
> file specified...  Pointers, tips appreciated!
>
> system("rename('/path/to/new.sh', '/path/to/old.$today')");
>
> /to directory has permissions set to current user and is also owned by
> the current user (test_user)... I can write files into the directory and
> delete files form the directory using the 'unlink()' command but the
> rename function I am having problems with.
> Jas

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Here is a function that will do this, assuming $items is an array you would
do the following:


// $size INTEGER 
// $width INTEGER 
// border INTEGER 
// $cpadding INTEGER 
// $cspacing INTEGER 
// $data ARRAY 

function horizontalTable($size, $width, $border, $cpadding, $cspacing,
$data)
{

        $table_width = $width;
        $width = intval($table_width / $size);

        $tr = '<TR ALIGN="left">';
        $td = "<TD WIDTH=\"$width\">%s</TD>";
        
        $table = "<TABLE WIDTH=\"$table_width\" BORDER=\"$border\"
CELLPADDING=\"$cpadding\" CELLSPACING=\"$cspacing\">" . $tr;

        $i = 0;
        foreach($data as $value)
        {
                $table .= sprintf($td, $value);
                $i++;

                if(!($i % $size)) {
                        $table .= '</TR>' . $tr;
                }
        }

        while($i % $size)
        {
                $table .= sprintf($td, '&nbsp;');
                $i++;
        }

        $end_tr = strlen($tr) * -1;
        if(substr($table, $end_tr) != $tr){
                $table .= '</TR>';
        } else {
                $table = substr($table, 0, $end_tr);
        }

        $table .= '</TABLE>';
        
        return $table;
        
}


-----Oiginal Message-----
From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 5:30 AM
To: dareal hamsta
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Sorting data into columns vertically

Where is your data stored? if you are using a DB surely using order by 
would less painfull?

all the best

dareal hamsta wrote:

> [ Please copy me off list. ]
>
> Say I have 7 items of data and I wish to sort them into 3 columns in a 
> HTML table. The items are unevenly sized, so rather than print them 
> out in rows - resulting in lots of wasteful whitespace - I would like 
> to output them in vertical order. However if I use the modulus 
> operator to check for when to break into a new column...
>
> foreach ($items as $item) {
>     $counter++;
>     if ( ($counter % $columns) == 0) {
>         print "</td><td>";
>     }
> }
>
> ...the output will be something like this...
>
>  +-------+-------+-------+
>  | Item1 | Item4 | Item7 |
>  | Item2 | Item5 |       |
>  | Item3 | Item6 |       |
>  +-----------------------+
>
> ...when what I'm really looking for is this...
>
>  +-------+-------+-------+
>  | Item1 | Item4 | Item6 |
>  | Item2 | Item5 | Item7 |
>  | Item3 |       |       |
>  +-----------------------+
>
> Obviously if the number of items and columns are static, I have no 
> problem, but how do I get a layout that appeals to people and not 
> computers if they're dynamic? This has me befuddled, I'm wondering is 
> there an algorithm for doing it or is it effectively a Turing Test.
>
> Thanks,
> adam
>
>
> <?php
> $s=array(74,65,112,104,112,72,32,59,45,41);
> for($i=0;$i<count($s);$i++){echo'&#'.$s[$i].';';}
> ?>
>
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE* 
> http://join.msn.com/?page=features/virus
>


-- 
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Here is a function I use. Assuming data is stored in an array called $items
you will call out horizontalTable() like this:

horizontalTable(3,600,1,3,3, $items);

Here is the horizontalTable() function code:

// $size: number of columns 
// $width: table width
// $border: table border
// $cpadding: table cellpadding
// $cspacing: table cellspacing
// $data: array with data you want to display

function horizontalTable($size, $width, $border, $cpadding, $cspacing,
$data)
{

        $table_width = $width;
        $width = intval($table_width / $size);

        $tr = '<TR ALIGN="left">';
        $td = "<TD WIDTH=\"$width\">%s</TD>";
        
        $table = "<TABLE WIDTH=\"$table_width\" BORDER=\"$border\"
CELLPADDING=\"$cpadding\" CELLSPACING=\"$cspacing\">" . $tr;

        $i = 0;
        foreach($data as $value)
        {
                $table .= sprintf($td, $value);
                $i++;

                if(!($i % $size)) {
                        $table .= '</TR>' . $tr;
                }
        }

        while($i % $size)
        {
                $table .= sprintf($td, '&nbsp;');
                $i++;
        }

        $end_tr = strlen($tr) * -1;
        if(substr($table, $end_tr) != $tr){
                $table .= '</TR>';
        } else {
                $table = substr($table, 0, $end_tr);
        }

        $table .= '</TABLE>';
        
        return $table;
        
}

-----Original Message-----
From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 5:30 AM
To: dareal hamsta
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Sorting data into columns vertically

Where is your data stored? if you are using a DB surely using order by 
would less painfull?

all the best

dareal hamsta wrote:

> [ Please copy me off list. ]
>
> Say I have 7 items of data and I wish to sort them into 3 columns in a 
> HTML table. The items are unevenly sized, so rather than print them 
> out in rows - resulting in lots of wasteful whitespace - I would like 
> to output them in vertical order. However if I use the modulus 
> operator to check for when to break into a new column...
>
> foreach ($items as $item) {
>     $counter++;
>     if ( ($counter % $columns) == 0) {
>         print "</td><td>";
>     }
> }
>
> ...the output will be something like this...
>
>  +-------+-------+-------+
>  | Item1 | Item4 | Item7 |
>  | Item2 | Item5 |       |
>  | Item3 | Item6 |       |
>  +-----------------------+
>
> ...when what I'm really looking for is this...
>
>  +-------+-------+-------+
>  | Item1 | Item4 | Item6 |
>  | Item2 | Item5 | Item7 |
>  | Item3 |       |       |
>  +-----------------------+
>
> Obviously if the number of items and columns are static, I have no 
> problem, but how do I get a layout that appeals to people and not 
> computers if they're dynamic? This has me befuddled, I'm wondering is 
> there an algorithm for doing it or is it effectively a Turing Test.
>
> Thanks,
> adam
>
>
> <?php
> $s=array(74,65,112,104,112,72,32,59,45,41);
> for($i=0;$i<count($s);$i++){echo'&#'.$s[$i].';';}
> ?>
>
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE* 
> http://join.msn.com/?page=features/virus
>


-- 
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
DISREGARD THIS ONE

-----Original Message-----
From: Ralph Guzman [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 4:35 PM
To: 'Raditha Dissanayake'; 'dareal hamsta'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Sorting data into columns vertically


Here is a function that will do this, assuming $items is an array you would
do the following:


// $size INTEGER 
// $width INTEGER 
// border INTEGER 
// $cpadding INTEGER 
// $cspacing INTEGER 
// $data ARRAY 

function horizontalTable($size, $width, $border, $cpadding, $cspacing,
$data)
{

        $table_width = $width;
        $width = intval($table_width / $size);

        $tr = '<TR ALIGN="left">';
        $td = "<TD WIDTH=\"$width\">%s</TD>";
        
        $table = "<TABLE WIDTH=\"$table_width\" BORDER=\"$border\"
CELLPADDING=\"$cpadding\" CELLSPACING=\"$cspacing\">" . $tr;

        $i = 0;
        foreach($data as $value)
        {
                $table .= sprintf($td, $value);
                $i++;

                if(!($i % $size)) {
                        $table .= '</TR>' . $tr;
                }
        }

        while($i % $size)
        {
                $table .= sprintf($td, '&nbsp;');
                $i++;
        }

        $end_tr = strlen($tr) * -1;
        if(substr($table, $end_tr) != $tr){
                $table .= '</TR>';
        } else {
                $table = substr($table, 0, $end_tr);
        }

        $table .= '</TABLE>';
        
        return $table;
        
}


-----Oiginal Message-----
From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 5:30 AM
To: dareal hamsta
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Sorting data into columns vertically

Where is your data stored? if you are using a DB surely using order by 
would less painfull?

all the best

dareal hamsta wrote:

> [ Please copy me off list. ]
>
> Say I have 7 items of data and I wish to sort them into 3 columns in a 
> HTML table. The items are unevenly sized, so rather than print them 
> out in rows - resulting in lots of wasteful whitespace - I would like 
> to output them in vertical order. However if I use the modulus 
> operator to check for when to break into a new column...
>
> foreach ($items as $item) {
>     $counter++;
>     if ( ($counter % $columns) == 0) {
>         print "</td><td>";
>     }
> }
>
> ...the output will be something like this...
>
>  +-------+-------+-------+
>  | Item1 | Item4 | Item7 |
>  | Item2 | Item5 |       |
>  | Item3 | Item6 |       |
>  +-----------------------+
>
> ...when what I'm really looking for is this...
>
>  +-------+-------+-------+
>  | Item1 | Item4 | Item6 |
>  | Item2 | Item5 | Item7 |
>  | Item3 |       |       |
>  +-----------------------+
>
> Obviously if the number of items and columns are static, I have no 
> problem, but how do I get a layout that appeals to people and not 
> computers if they're dynamic? This has me befuddled, I'm wondering is 
> there an algorithm for doing it or is it effectively a Turing Test.
>
> Thanks,
> adam
>
>
> <?php
> $s=array(74,65,112,104,112,72,32,59,45,41);
> for($i=0;$i<count($s);$i++){echo'&#'.$s[$i].';';}
> ?>
>
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE* 
> http://join.msn.com/?page=features/virus
>


-- 
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/         | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message --- Diana Castillo wrote:

Is there any way to limit the connections so that this error never happens?
Warning: mysql_connect(): Too many connections at
/home/local/global/php/libraries/dblayer_mysql.php line 14.

The connections are already limited, that's why you get this warning. You need to handle this from the MySQL side and increase the number of connections allowed either when you start MySQL or in a config file. Directions are in the manual, of course. :)


--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
=======================================
This message is for the benefit of new subscribers 
and those new to PHP.  Please feel free to add 
more points and send to the list.
=======================================
1. If you have any queries/problems about PHP try 
http://www.php.net/manual/en first. You can 
download a copy and use it offline also. 

Please also try http://www.php.net/manual/faq.php 
to get answers to frequently answered questions 
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching for 
"php YOUR QUERY" may fetch you relevant results 
within the first 10 results, if you are lucky.

3. There is a searchable archive of the mailing 
list discussion at 
http://phparch.com/mailinglists. Many of the 
common topics are discussed repeatedly, and you 
may get answer to your query from the earlier 
discussions. 

For example: One of the repeatedly discussed 
question in the list is "Best PHP editor". 
Everyone has his/her favourite editor. 
You can get all the opinions by going through the 
list archives. If you want a chosen list try this 
link : http://phpeditors.linuxbackup.co.uk/ 
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want find out 
what extensions are available to you?

Just put the following code into a file with a 
.php extension and access it through your 
webserver:

<?php
        phpinfo();
?> 

If PHP is installed you will see a page with a lot 
of information on it. If PHP is not installed (or 
not working correctly) your browser will try
to download the file.

(contributed by Teren and reworded by Chris W 
Parker)

5. If you are stuck with a script and do not 
understand what is wrong, instead 
of posting the whole script, try doing some 
research yourself. One useful trick is to print 
the variable/sql query using print or echo 
command and check whether you get what you 
expected. 

After diagnosing the problem, send the details of 
your efforts (following steps 1, 2 & 3) and ask 
for help.

6. PHP is a server side scripting language. 
Whatever processing PHP does takes 
place BEFORE the output reaches the client. 
Therefore, it is not possible to access the 
users'  computer related information (OS, screen 
size etc) using PHP. You need to go for 
JavaScript and ask the question in a JavaScript 
list.

On the other hand you can access the information 
that is SENT by the user's browser when a client 
requests a page from your server. You can
find details about browser, OS etc as reported by 
this request. - contributed by Wouter van Vliet 
and reworded by Chris W Parker.

7. Provide a clear descriptive subject line. Avoid 
general subjects like "Help!!", "A Question" etc.  
Especially avoid blank subjects. 

8. When you want to start a new topic, open a new 
mail composer and enter the mailing list address 
[EMAIL PROTECTED] instead of replying to 
an existing thread and replacing the subject and 
body with your message.

9. It's always a good idea to post back to the 
list once you've solved your problem. People 
usually add [SOLVED] to the subject line of their
email when posting solutions. By posting your 
solution you're helping the next person with the 
same question. [contribued by Chris W Parker]

10. Ask smart questions  
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

Hope you have a good time programming with PHP.

Best regards,
-- 
Integrated Management Tools for leather industry
----------------------------------
http://www.leatherlink.net

Ma Siva Kumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106

--- End Message ---
--- Begin Message ---
Hi,
I'm using debian-unstable.

I just installed apache-1.3 and php4.

I don't know where else to ask. I made a php test file (phpinfo.php),
containing: <? phpinfo(); ?>, and put it in ~/public_html.

When i try to see it by putting: http://127.0.0.1/phpinfo.php into
mozilla 1.2.1, mozilla changes it to http://211.27.78.162/.

Is this a mozilla config problem or apache problem? I have my dialup isp
nameservers in /etc/resolv.conf.

--- End Message ---
--- Begin Message --- The following code doesn't do what I expect and I was wondering if someone could tell me why and how to make it do what I want.

$NowT = strtotime("January 9 2004");
$EventT = strtotime("June 1 2004");
print ($EventT - $NowT)/86400;

I get 143.958333333

Why don't I get 144?

Chris W
--- End Message ---
--- Begin Message --- Sorry, had my return address set up wrong, apparently the list doesn't like that.

Actually, it appears to be caused by Daylight Savings time.
Leap years yield 143.958333333
Other years yield 142.958333333


At 10:07 PM 1/9/2004, Chris W wrote:
The following code doesn't do what I expect and I was wondering if someone could tell me why and how to make it do what I want.

$NowT = strtotime("January 9 2004");
$EventT = strtotime("June 1 2004");
print ($EventT - $NowT)/86400;

I get 143.958333333

Why don't I get 144?

Chris W

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Hi all,

I m generating an Excel file though PHP by sending the appropriate header and then 
using HTML <TD> tags to write data in different cells. Below is my code snippet.

It has got 1 problems:

1. Image doesn't come/showup in Excel sheet.

<?php

header("Content-type: application/vnd.ms-excel");
header("Content-disposition: attachment; filename=pareto_combined.xls");
?>

<tr colspan=8>
<td height=50> <img src='../../../extra/images/log.jpg'></td> 
<td align=right><img src='../../../extra/images/mickey_sup.jpg'></td> 
</tr> 

<?php
$dateF=$_REQUEST['dateF']; 

$dateT=$_REQUEST['dateT'];

$agentID=$_REQUEST['agentID'];
<tr>
<td class='graybg'><?php echo $agentID</td>
<td class='graybg'><?php echo $dateF</td>
<td class='graybg'><?php echo $dateT</td>
</tr>

?>

now after saving the Excel file it displays all alphanumeric data correctly but images 
do not show up. i think Img tag is not supported by Excel application. 

So my question is how can i display the images in Excel using PHP? plz help me out 

Thanks in advance

Binay 



--- End Message ---
--- Begin Message ---
After moving my PHP files to a new hard drive and a new windows
installation, my rand function gets stuck and only gives you one number over
and over.  It worked a few times then got stuck.  I tried using IIS 5.1 (I
was using Xitami) and it gave me the same results.  It even gets stuck on
the same number as the other webserver. I tried installing on a different
machine.  Same result.  Can anyone help?

Thanks

--- End Message ---
--- Begin Message ---
Hello nefar,

Friday, January 9, 2004, 6:05:34 AM, you wrote:

n> After moving my PHP files to a new hard drive and a new windows
n> installation, my rand function gets stuck and only gives you one number over
n> and over.  It worked a few times then got stuck.  I tried using IIS 5.1 (I
n> was using Xitami) and it gave me the same results.  It even gets stuck on
n> the same number as the other webserver. I tried installing on a different
n> machine.  Same result.  Can anyone help?

Which version of PHP are you using? If it's earlier than 4.2.0 you
need to see the rand() function first, or it will return the same
numbers each time. Use srand() to do this.

Also, are you passing in values to the rand() function? (your min and
max values) - on Windows there is a limit on the max value of 32,768.

-- 
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]

--- End Message ---

Reply via email to