RE: [PHP] Excel Spreadsheet Writer

2006-10-03 Thread Jef Sullivan
OUTSTANDING!!!

Thanks for taking the time.

 

However, I am bit confused. Are you telling me that the blank lines are what is 
causing my problems?

 

 

Jef 

 



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 03, 2006 12:41 PM
To: Jef Sullivan; php-general@lists.php.net
Subject: re: [PHP] Excel Spreadsheet Writer

 

Jef, 

Hello, Knowing nothing about Excel Writer at the start, I thought I would 
tackle this... 

I found all of the pieces on the net and copied to my webserver...

I got the same results you did  until I got my header warnings fixed:

Warning: Cannot modify header information - headers already sent by (output 
started at C:\WebServ\www\trunk\include\parser.php:1762) in 
C:\WebServ\www\trunk\include\excelWriter.php on line 67

Warning: Cannot modify header information - headers already sent by (output 
started at C:\WebServ\www\trunk\include\parser.php:1762) in 
C:\WebServ\www\trunk\include\excelWriter.php on line 68

Warning: Cannot modify header information - headers already sent by (output 
started at C:\WebServ\www\trunk\include\parser.php:1762) in 
C:\WebServ\www\trunk\include\excelWriter.php on line 69

Warning: Cannot modify header information - headers already sent by (output 
started at C:\WebServ\www\trunk\include\parser.php:1762) in 
C:\WebServ\www\trunk\include\excelWriter.php on line 70

Warning: Cannot modify header information - headers already sent by (output 
started at C:\WebServ\www\trunk\include\parser.php:1762) in 
C:\WebServ\www\trunk\include\excelWriter.php on line 71

I had serveral others besides the ones listed above...  These are caused by 
PHP Scripts that post anything before or after the Excel (or any other ) 
Headers are sent... AND THIS INCLUDES BLANK LINES.
My problems were caused by:

1.
2.

Line one above can't be present.

and: 

1.   
10.
11.

Lines 10 and 11 above can't be present...

Once I fixed all of my "Cannot Modify Headers" errors, the Cut and Paste of 
your exact code, created an Excel Spread Sheet. 

When I ran your code, I got a Open File Dialog box, that says:  "You have 
chosen to open"test.xls" which is a Microsoft Excel Spreadsheet...  What 
should Firefox do ?  Save or Open.-

I chose open, and there it is ! 

I got no output on my Web Browser page at all  ( View source just showe 
 )

Hope this Helps.

Scot L. Diddle, Richmond VA, UPS Freight, 804.231.8407 

________

From: "Jef Sullivan" <[EMAIL PROTECTED]>
Sent: Monday, October 02, 2006 8:44 PM
To: php-general@lists.php.net
Subject: [PHP] Excel Spreadsheet Writer

Greetings all,



I am having some problems with the Excel Spreadsheet Writer and I am hoping 
that I can get some help from

this group. I am getting garbled text in my spreadsheet when I go to run the 
php file. I created a general file to 

see if I could narrow the problem down. No luck so far…



This is what I am getting in the spreadsheet…



ÐÏࡱá; 


þÿ  


þÿÿÿ[1]
 




 
þÿÿÿ
 l ÉB[1]ä 


[1] 


My first 
worksheet=¼%r8X[1]"[1]1ÈÿArial1ÈÿArial1ÈÿArial1ÈÿArial1ÈÿArial1È
 Arialàõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À 
àõÿ À àõÿ À àõÿ À à À à À “[1] 


€ÿ’â8€ÀÀÀ€€€™™ÿ™3fÿÿÌÌÿÿffÿ€€fÌÌÌÿ€ÿÿ€ÿÌÿÌÿÿÌÿÌÿÿ™™Ìÿÿ™ÌÌ™ÿÿÌ™3fÿ3ÌÌ™ÌÿÌÿ™ÿfff™–––3f3™f333™3™3f33™333…?
 


My first worksheet l É[1][1][1]*[1]+[1]€‚[1][1]Á 


¡"d[1]X[1]X[1]à?à?[1] 


[1] 


[1] 


Name 


[1] 


Age 


[1] John Smith 

[PHP] Excel Spreadsheet Writer

2006-10-02 Thread Jef Sullivan
Greetings all,

 

I am having some problems with the Excel Spreadsheet Writer and I am hoping 
that I can get some help from

this group. I am getting garbled text in my spreadsheet when I go to run the 
php file. I created a general file to 

see if I could narrow the problem down. No luck so far…

 

This is what I am getting in the spreadsheet…

 

ÐÏࡱá; 


þÿ  


þÿÿÿ[1]
 




 
þÿÿÿ
 l ÉB[1]ä 


[1] 


My first 
worksheet=¼%r8X[1]"[1]1ÈÿArial1ÈÿArial1ÈÿArial1ÈÿArial1ÈÿArial1È
 Arialàõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À àõÿ À 
àõÿ À àõÿ À àõÿ À à À à À “[1] 


€ÿ’â8€ÀÀÀ€€€™™ÿ™3fÿÿÌÌÿÿffÿ€€fÌÌÌÿ€ÿÿ€ÿÌÿÌÿÿÌÿÌÿÿ™™Ìÿÿ™ÌÌ™ÿÿÌ™3fÿ3ÌÌ™ÌÿÌÿ™ÿfff™–––3f3™f333™3™3f33™333…?
 


My first worksheet l É[1][1][1]*[1]+[1]€‚[1][1]Á 


¡"d[1]X[1]X[1]à?à?[1] 


[1] 


[1] 


Name 


[1] 


Age 


[1] John Smith 


[1]
>@ 


[1][1]
Johann Schmidt 


[1]
[1]?@ 


[1] 


 Juan Herrera 


[1]



@@)ð?(ð?'è?&è?„[1]ƒ[1]>[1] ¶ 


 Root Entry [1]ÀFC‑x'æÆC‑x'æÆÀ 


Book [1]

 

This output makes me thing that the reference to the Writer.php file is not 
correct. I have verified that the file is located in the given path and that

All other references are correct. Here is my code for the generic test file….

 

send('test.xls');

 

// Creating a worksheet

$worksheet =& $workbook->addWorksheet('My first worksheet');

 

// The actual data

$worksheet->write(0, 0, 'Name');

$worksheet->write(0, 1, 'Age');

$worksheet->write(1, 0, 'John Smith');

$worksheet->write(1, 1, 30);

$worksheet->write(2, 0, 'Johann Schmidt');

$worksheet->write(2, 1, 31);

$worksheet->write(3, 0, 'Juan Herrera');

$worksheet->write(3, 1, 32);

 

// Let's send the file

$workbook->close();

?>

 

Any suggestions on getting this resolved?

If this is the wrong list, please let me know where I can send this question.

Perhaps it is the way I installed the Writer? All I did was copy it over from 
another machine.

 

 

 

Jef Sullivan

Programmer

Progrexion

work:   801-828-1745

moble: 801-682-9727

email:  [EMAIL PROTECTED]

 

Research | Marketing | Sales Generation   www.progrexion.com 
<http://www.progrexion.com> 

 

This email and its contents are confidential. If you are not 

the intended recipient, delete this email and do not use or

disclose the information within this eamil or its

attachements. Thank you.

 



[PHP] addFormat with Spreadsheet Excel Writer

2006-09-08 Thread Jef Sullivan
Greetings all,

 

Thanks for the help with the Spreadsheet Excel Writer yesterday.

I was wondering if anyone knew of problems with the addFormat() 

within the writer and PHP 5.0. I have followed the examples for

setting up a specific format but it is not being recognized.

 

Here is what I have tried...

 

$format_bold =& $workbook->addFormat();

$format_bold->SetBold();

 

And

 

$title_format =& $workbook->addFormat(array('fontfamily' => 'Arial',

 
'size' => 13,

 
'color' => 'black',

 
'bgcolor' => '#C0C0C0',

 
'bold' => 1)

   );

 

Neither have worked. The error I get is pointing to the
Writer/Worksheet.php 

file, line 1242 indicating that it cannot be converted. Yet, this same
code

was used in another application that is running PHP 4.2

 

 

 

 

Jef Sullivan

Programmer

Progrexion

work   (801) 828-1745

moble (801) 682-9727

[EMAIL PROTECTED]

 

 

Research | Marketing | Sales Generation

 

This email and its contents are confidential. If you are not the 

intended recipient, delete this email and, do not use or 

disclose the information contained within or its attachments.

Thank you.

 



[PHP] Spreadsheet Writer

2006-09-07 Thread Jef Sullivan
Greeting all,

I have done some research on the web with no luck so far. 
I will continue to check some other options but I wanted
To check here as well.

I have used the Spreadsheet Excel Writer with PHP before 
With great success. What I need to do now is create some
Charts with this application.

Does any one know if that is possible?
If so, can you give me a reference for that information?


Thanks,

Jef

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



RE: [PHP] calendar Q

2006-08-11 Thread Jef Sullivan
I like using mktime() whenever I pull dates from a database.
Get your date from the query, store it to a value:

$val = mktime($qval);

Then you can compare any part of the date you want by using
date(). 

if( date( "m", date(now)) == date( "m", $val ))

m = month



Jef
-Original Message-
From: William Stokes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 10, 2006 11:23 PM
To: php-general@lists.php.net
Subject: Re: [PHP] calendar Q

Ok. Thanks.

One more question. I have dates as a datetime in DB. Like 2006-08-11 
08:20:00 and I'm playing only with date part in the calendar 2006-08-11. So 
how to compare this date to the datetime info in DB? Do I need to use 
DATE_FORMAT or someting like this in the query?

Thanks
-Will



""Richard Lynch"" <[EMAIL PROTECTED]> kirjoitti 
viestissä:[EMAIL PROTECTED]
> On Thu, August 10, 2006 12:14 pm, William Stokes wrote:
>> I have a calendar script that displays a simple mini calendar view one
>> month
>> at a time. User can click any date and the calendar opens another page
>> that
>> displays that date's events. I would like to highlight to the mini
>> calendar
>> view dates that have an event in database. So what would be a simple
>> way to
>> check for events while the selected months days are printed to screen?
>
> Depending on the number of records, the PHP<->MySQL connection speed,
> and the indexes or lack thereof on your date column...
>
> 1. You could do a query for each date like:
> select count(*) from events where whatdate = '$date'
>
> 2. You could pre-fill an array with dates that have an event:
> select whatdate from events
> where whatdate >= '$month/1/$year'
> and whatdate < '{$month+1}/1/$year' /*might need something better here*/
> group by whatdate
> order by whatdate
> while (list($whatdate) = mysql_fetch_row($result)){
>  $event_date[$whatdate] = true;
> }
> Then, while filling out the calendar, just check:
> if (isset($event_date[$date])){
>  //color it as having events
> }
>
> -- 
> Like Music?
> http://l-i-e.com/artists.htm 

-- 
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



RE: [PHP] Cron running 'Hello world' script dies with "Could not startup."

2006-08-08 Thread Jef Sullivan
Here is the cron command that we use. I've modified the path to the file for 
security purposes.

*/5 * * 1-6 lynx -dump http://fully.qualified.path/cron_test.php 
-auth=usr:pwd 




Jef
-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 08, 2006 7:11 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Cron running 'Hello world' script dies with "Could not 
startup."

Ivo F.A.C. Fokkema wrote:
> Hi guys,
> 
> I'm really stuck with this error and since my backup scripts are no
> longer running automatically through cron, I really need to get this
> fixed soon :)
> 
> Suddenly my backup scripts die with the error "Could not startup.". Only
> through the cron, it runs fine through the console. I've tried all kinds
> of tests with other PHP scripts, tried a different PC, asked my
> distribution mailing list, tried Google and searching this list,
> nothing...
> 
> Script:
>  echo "Hello\n";
> ?>
> 
> This is the crontab line:
> * * * * * /usr/bin/php -f /home/ifokkema/test.php
> 
> - Running the exact same command from the command line works perfectly.
> - Cron output is nothing more than "Could not startup.".
> - Have not changed the PHP installation or a cron related package.
> - Distribution: Ubuntu Dapper, problems started July 31st. Possibly
> after an upgrade, can't remember.
> - Tried on different Ubuntu Dapper install, same result.
> - PHP version: 4.4.2-1build1
> - Yes, I've verified that I'm using the PHP-cli executable.
> 
> Thanks for any input!
> 
> Ivo
> 

Does the user running the cron have permission to execute the php binary?

-- 
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

-- 
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



[PHP] php and printing

2006-08-07 Thread Jef Sullivan
Greetings to everyone,

 

I have been able to program the capability of printing several
end-of-month statements at the click of a 

button using php. The problem I am faced with is when one of these
statements has more than one page.

Management would like to have the second page have a header similar to
the first page. 

 

My question is this, has anyone here ever set up printing through php
(or javascript) and dealt with 

multiple pages before? If so, where can you direct me for assistance?

 

 

 

 

 

Jef

 



[PHP] [RESOLUTION] -- Spreadsheet Excel Writer

2006-07-13 Thread Jef Sullivan
Yesterday I wrote a request for some help with setting the column width
when exporting a php generated 

page to Excel. After further research I was able to find setColumn().
There were some that asked

what I was able to come up with when using this feature since the
documentation is incomplete.

 

For those of you that are using the Spreadsheet Excel Writer with Pear
and PHP use the following

to set the width of a column...

 

// Creating a workbook

$workbook = new Spreadsheet_Excel_Writer();

 

//Setting column width

$worksheets1->setColumn(0,0,10.00);

 

This example breakdown as follows...

 

setColumn(0,0,10.00) == the first column to be affected by the width

setColumn(0,0,10.00) == the last column to be affected by the width

setColumn(0,0,10.00) == the width as a float

 

The setColumn() needs to be set before any data is being written to the
spreadsheet. If you only 

wont one column to be affected by the setColumn() then you set the first
and last column

values to the same column number. If you want to affect more than one
column you can set the

last column to the desired column number, just remember the column
numbering begins with a 0.

 

 

 

 

Jef Sullivan

J-MAC & AutoAir

3520 South State Street

Salt Lake City, UT  84115

801-269-2030 - Telephone

801-269-2065 - Fax

 

 

 



RE: [PHP] setting column width

2006-07-12 Thread Jef Sullivan
I did some more googling and found some information on setColumn().
Thanks for your responses.



Jef
-Original Message-
From: Jef Sullivan [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 12, 2006 12:57 PM
To: php-general@lists.php.net
Subject: [PHP] setting column width

I am using the Spreadsheet Excel Writer tool to export a php generated
page to an Excel Spreadsheet.

The information is being generated properly but the display is not
functioning as I would like. The column 

headers are not automatically setting the width of the column as I was
expecting.

 

I have googled for this information but I have not been able to find an
answer. I'm beginning to think 

that it is not possible. Before I go on to something else I thought I
would ask the group.

 

Is there a way to set the column width using the writer tool?

Also, is there a way of putting a break in the column headers? For
example I want...

 

Total Amount

 

to look like...

 

  Total

Amount

 

 

Thanks for any help

 

Jef

 

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



[PHP] setting column width

2006-07-12 Thread Jef Sullivan
I am using the Spreadsheet Excel Writer tool to export a php generated
page to an Excel Spreadsheet.

The information is being generated properly but the display is not
functioning as I would like. The column 

headers are not automatically setting the width of the column as I was
expecting.

 

I have googled for this information but I have not been able to find an
answer. I'm beginning to think 

that it is not possible. Before I go on to something else I thought I
would ask the group.

 

Is there a way to set the column width using the writer tool?

Also, is there a way of putting a break in the column headers? For
example I want...

 

Total Amount

 

to look like...

 

  Total

Amount

 

 

Thanks for any help

 

Jef

 



[PHP] PHP Automation

2006-06-19 Thread Jef Sullivan
Greetings all,

 

I have a situation that I'm not sure how it can be done with PHP. I have
written a web-application that produces 

a monthly statement for our customers. Now, I need to automate the
printing of these monthly statements.

The way I was thinking of doing this was through Perl. However, I have
discovered that a Perl script will not 

work. 

 

I know I can build the URL to the monthly statement. What I don't know
how to do is automate this process

and get it to print to a specific printer. Any help would be greatly
appreciated.

 

 

 

 

Jef 

 

 



RE: [PHP] Please help me with a query

2006-06-13 Thread Jef Sullivan
Your query is wrong. You are selecting only one result yet you are 
referencing three. I suggest...

SELECT * FROM centers ORDER BY idc asc


Jef

-Original Message-
From: Jesús Alain Rodríguez Santos [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 13, 2006 8:49 AM
To: php-general@lists.php.net
Subject: [PHP] Please help me with a query

First of all I'm sorry for my english I don't know speak very well, I will 
try to explain it, I hope you understain what I need.

I have two tables: centers and peoples, in table centers I have the centers 
values and in table peoples I have the peoples values and in table columns 
center the id corresponding the center.

db:
centers
id  nameccorreoc   telc
1 Cienfuegos  [EMAIL PROTECTED]  4534345
2   Havana [EMAIL PROTECTED] 4643765
3  Santiago[EMAIL PROTECTED]  3453453

peoples
idnamed   center  correod 
cargod
1 Albert  1   [EMAIL PROTECTED] 
sfgsdfgsdfgsdfg
2  Julio1  [EMAIL PROTECTED] 
sadfsgfdsfgfdsg
3 Sussan 2  [EMAIL PROTECTED] 
gjfhjfhjfhjfg
4 Peter2  [EMAIL PROTECTED] 
fgjhfgjgfjhjjghj

And the query and script to generate the tables for each centers list is:

$centers = mysql_query("SELECT namec FROM centers ORDER BY idc asc", 
$connect);

while ($centerss = mysql_fetch_array($centers, MYSQL_ASSOC)) {
   echo "";
echo "";
echo "".$centerss['namec']."";
echo "mailto:".$centerss['correoc'].">".$centerss['correoc']."";
echo "".$centerss['telc']."";
echo "";
echo "";
}
mysql_free_result($centers);

That's generate one table with one row and three columns for each center, 
but, I would like to generate more rows and 3 columns in each table with the 
named, correod and cargod of peoples corresponding the center, I mean, print 
the centers values with the peoples corresponding this center, in one table 
each one.

I hope you understaind what I need, if not polease let me know.

regards Alain


-- 
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.

-- 
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



RE: [PHP] Skip first 4 array values

2006-06-09 Thread Jef Sullivan
Why?


Jef

-Original Message-
From: Jonas Rosling [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 09, 2006 7:48 AM
To: PHP List
Subject: [PHP] Skip first 4 array values

Is there any way you can skip for example the first 4 array
values/posisions
in an array no matter how many values it contains?

Thanks // Jonas

-- 
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



RE: [PHP] parsing out quoted text

2006-06-09 Thread Jef Sullivan
Set your string to an array and use the elements in your query.



Jef

-Original Message-
From: sam [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 09, 2006 6:53 AM
To: PHP
Subject: [PHP] parsing out quoted text


$str='bass "electric organ" bagpipes';

$parser($str);

$query="SELECT * FROM table WHERE tb_instr = "bass"
> AND tb_instr = "electric organ" //< AND tb_instr = "bagpipes";


Anybody know where I can just copy code that will do the above?

thanks

-- 
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



RE: [PHP] file from database work local, but not on server

2006-06-08 Thread Jef Sullivan
What happens when you print out the query to the page?
Is the query correct?



Jef

-Original Message-
From: Peter Lauri [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 07, 2006 1:10 PM
To: php-general@lists.php.net
Subject: [PHP] file from database work local, but not on server

Best group member,

This code works fine on my local machine:

$Query = sprintf("SELECT * FROM filestorage WHERE id=%s LIMIT 1",
$_GET['fileid']);
$Result = mysql_query($Query);
if (mysql_num_rows ($Result)>0) {
  $Row = @mysql_fetch_array ($Result);
  $file_type = $Row["filetype"];
  $file = $Row["filedata"];
  header ("Content-type: $file_type");
  header("Content-Disposition: attachment;
filename=fil".substr($Row['filename'], strrpos($Row['filename'], '.')));
'.')).'"
  print $file;
}

But when I run it on my server it does not start the download, and the
file
name is the location of the script instead of what I state as file name.

Is this a server issue? I run Linux server with Plesk. Is there anyone
with
the same problems?

Best regards,
Peter Lauri

-- 
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



RE: [PHP] pop-up window in php???

2006-05-30 Thread Jef Sullivan
The code would be quicker and fewer lines if you did this with
Javascript, but you could do it with PHP. Use an iframe for the yes / no
options, 
create a form, then capture the response and display the results as you 
wish. 



Jef

-Original Message-
From: Adam Zey [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 29, 2006 12:59 PM
To: [EMAIL PROTECTED]
Cc: [php] PHP General List
Subject: Re: [PHP] pop-up window in php???

[EMAIL PROTECTED] wrote:
> ok, maybe I didn't make my question too clear. I was mostly wondering
if there
> is a way to do it in PHP rather than Javascript. I would prefer only
using php.
> 
> and from the answers I got, I take it that there is no way of doing it
in PHP.
> 
> thanks,
> Siavash
> 
> 
> 
> Quoting Andrei <[EMAIL PROTECTED]>:
> 
>>  Not related to PHP, but u hava javascript confirm function or
prompt 
>> (if you need input also).
>>
>>  Andy
>>
>> [EMAIL PROTECTED] wrote:
>>> Hi all,
>>>
>>> Is there anyway to have a pop-up window to ask "are you sure? yes /
no" in
>> php?
>>> I know you can do it in Javascript, but I'm not sure what's the best
way
>> to
>>> implement it in php. I want the page to do nothing if "no" is
pressed.
>>>
>>> any help would be appreciated.
>>>
>>> thanks,
>>> Siavash
>>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

PHP is a server-side language. It cannot directly influence anything on 
the client-side. That is why you need to have your PHP script output a 
client-side scripting language such as JavaScript. You are still only 
executing PHP code on the server.

Regards, Adam Zey.

-- 
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



RE: [PHP] parsing/replacing for special MS Word characters

2006-05-24 Thread Jef Sullivan
Start here...

http://www.php.net/manual/en/function.preg-replace.php



Jef

-Original Message-
From: Dan McCullough [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 24, 2006 8:35 AM
To: PHP LIST
Subject: [PHP] parsing/replacing for special MS Word characters

I have a friend who I wrote some very simple publishing software,
basically he takes his writtings and puts them online.  Well his
writtings are in Word and so he has alot of special characters that he
inputs, some unknowingly, into the database.  Are there any classes or
samples of what others have done to strip/replace/find these special
characters, I have asked him to be careful, but he will do it once or
twice and then forget and lapse, and I get a call saying can you help
me get these out.

Any ideas?

-- 
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



RE: [PHP] date iteration

2006-05-24 Thread Jef Sullivan
Richard is correct, the format for the mktime() is
hours/minutes/seconds/month/day/year. My code suggestion is based
on the start date being entered as follows -- 05242006, and the 
display is to be 05/24/2006. My suggestion is the following...

function generateDates($first, $duration)
{
$dates = array();
$smonth = substr($first,0,2);
$sday = substr($first,2,2);
$syear = substr($first,4,4);
$start_date = mktime(0,0,0,$smonth,$sday,$syear);

for ($i = 1; $i <= $duration; $i++)
{
$added = mktime(0,0,0,$smonth,$sday+$i,$syear);
$dates[$i] = date( "m/d/Y", $added );
}

return $dates;
}

[SNIP]

Good luck,


Jef

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 23, 2006 3:27 PM
To: Dave Goodchild
Cc: php-general@lists.php.net
Subject: Re: [PHP] date iteration



mktime() args are hour/minute/second/month/day/year or somesuch.

You are passing in a string, which PHP tries to convert to int, which
results in who knows what, on the line that starts $added =

On Tue, May 23, 2006 6:11 am, Dave Goodchild wrote:
> Hi all, I am writing an app that runs a prize draw, wherein the admin
> chooses the duration by adding a start date and number of days for the
> draw
> to run. These values are passed into a small function that generates
> an
> array holding the start date, end date and all dates in between as
> follows:
>
> function generateDates($first, $duration) {
>
> $dates = array();
> $date = getdate(mktime($first));
> $month = $date['mon'];$day = $date['mday'];$year = $date['year'];
>
> for ($i = 1;$i <= $duration; $i++) {
>
> $added = getdate(mktime($day++ . "-" . $month . "-" . $year));
> $dates[] = $added['mday'] . "-" . $added['mon'] . "-" .
> $added['year'];
>
> }
> return $dates;
> }
>
>
> $series = generateDates('23-05-2006', 20);
> var_dump($series);
>
> ...when I var_dump the array the iteration stops at May 24 - I am
> looking
> into it but does anyone have any ideas why this is sticking ie is my
> date
> arithmetic wrong? Cheers.
>
> --
> http://www.web-buddha.co.uk
>
> dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml,
> css)
>
> look out for project karma, our new venture, coming soon!
>


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
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



RE: [PHP] selecting current month from a database

2006-05-22 Thread Jef Sullivan
$cur_month = date("m");
while ($r = mysql_fetch_array($month_query))
{
$v = $r["m_id"];
  $out = $r["months"];
if( $cur_month = $v )
{
echo("".$out."")
}

}




Jef

-Original Message-
From: Paul Novitski [mailto:[EMAIL PROTECTED] 
Sent: Sunday, May 21, 2006 2:55 AM
To: php-general@lists.php.net
Subject: Re: [PHP] selecting current month from a database

At 11:45 PM 5/20/2006, Paul Goepfert wrote:
>I have a drop down menu where I have the
>months of year as menu items.  I want to be able to have the current
>month be the selected month.  I have tried using the date function as
>the way to set the current month as the selected value but it seems
>that every value entered in the select box is set to selected.
>
>Here is my code maybe someone can help me out
>
>$month_query = mysql_query("SELECT m_id, months FROM Month");
> while ($r = mysql_fetch_array($month_query))
> {
> $v = $r["m_id"];
> $out = $r["months"];
> echo("$out\n");
> }
>
>Just incase you want to know
>
>m_id = 1..12
>months = January..December
>
>How do I set only the current month to selected ?


Paul,

The syntax for pre-selected options is:

HTML:  [1]
XHTML:  [2]

Options that are not pre-selected simply omit the 
selected attribute altogether.

Therefore you'll want code something like this:

 while ($r = mysql_fetch_array($month_query))
 {
 $v = $r["m_id"];// numeric month
 $out = $r["months"];// verbal month

 // select option for current month
 if ($v == date("n"))
 {
 $selected = 'selected="selected"';
 }else{
 $selected = '';
 }

 echo "$out\n";
 }

Notes:

- date("F") is the verbal month; date("n") is 
numeric [3].  Therefore you'll want to compare $v 
with date("n") or $out with date("F").

- Adhering to XHTML syntax, I've put the attribute values in quotes. [2]

- FYI, you can harmlessly include parentheses in 
the echo statement but echo is actually not a 
function and doesn't require parens [4].

Regards,
Paul


[1]
W3C HTML 4.01 Specification
17 Forms
17.6.1 Pre-selected options
http://www.w3.org/TR/html4/interact/forms.html#h-17.6.1

[2]
XHTML(tm) 1.0 The Extensible HyperText Markup Language (Second Edition)
4. Differences with HTML 4
4.4. Attribute values must always be quoted
http://www.w3.org/TR/xhtml1/#h-4.4

[3]
PHP Manual
VI. Function Reference
CLI. String Functions
echo
http://php.net/echo

[4]
PHP Manual
VI. Function Reference
XXII. Date and Time Functions
date
http://php.net/date

-- 
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



FW: [PHP] Date() finding yesterday

2006-05-22 Thread Jef Sullivan
The easiest way I found to do this is using mktime().
If you don't care about the time for the date you can use this...

$yesterday = mktime(0,0,0,date("m"),date("d")-1,date("Y"));

This translates to yesterday morning after midnight.

If you want the present time, only 24 hours before, use this...

$yesterday =
mktime(date("H"),date("i"),date("s"),date("m"),date("d")-1,date("Y"));

To display the date use...

date( "m/d/Y", $yesterday );

Or you can put the mktime code in play of $yesterday in the above line
of
code.

Good luck,



Jef

-Original Message-
From: Scott Hurring [mailto:[EMAIL PROTECTED] 
Sent: Sunday, May 21, 2006 12:18 PM
To: Rabin Vincent; php-general@lists.php.net
Subject: Re: [PHP] Date() finding yesterday

mktime also works: http://php.net/mktime:

date("Y-m-d", mktime( ... ))

On 5/21/06, Rabin Vincent <[EMAIL PROTECTED]> wrote:
>
> On 5/21/06, John Taylor-Johnston
> <[EMAIL PROTECTED]> wrote:
> > I cannot seem to get this right. How can I produce yesterday?
> >
> > $today = date("Y-m-d");
> > $yesterday = date("Y-m-") . date("d")-1;
> > $yesterday = date("Y-m-d")-1;
> > $yesterday = date("Y-m-"."d"-1);
> >
> > I've been looking at the manual :) ...
>
> Use php.net/strtotime:
>
> $yesterday = date('Y-m-d', strtotime('-1 day'));
>
> Rabin
>
> --
> http://rab.in
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Scott Hurring [scott dot hurring dot lists at gmail dot com]
http://hurring.com/

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



RE: [PHP] PHP & JavaScript

2006-05-19 Thread Jef Sullivan
I use document.getElementById().value.
The only change that would need to be made with the input example is add
an id="list['.$x.']"



Jef

-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 19, 2006 8:47 AM
To: php-general@lists.php.net
Subject: Re: [PHP] PHP & JavaScript

Jay Blanchard wrote:
> Can they play nicely together?
> 
> For instance I have a small JavaScript sniplet that will check certain
> checkboxes if a radio button is selected. Since I have a fair amount of
> checkboxes I want to put them in an array all their own so I use the
> XHTML syntax w/brackets;
> 
> 
> 
> Suddenly JavaScript doesn't care for the object and throws an error
> (take the brackets out and it works fine for JS, but PHP cannot see all
> of the values). I have Googled for this but think that my search term(s)
> are failing me because the condition is hard to describe.  Would someone
> please point me in the right direction?
> 
> Thanks!
> 

I don't remember exactaly what I had to do, but I remember quoting it 
somehow made it work with JS.  Something like...

document.formname.elements['list37[]']

I *think*.

-- 
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

-- 
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



RE: [PHP] Mktime formatting problems

2006-05-11 Thread Jef Sullivan
Here is what I have used for mktime..

$unix_date_33 = mktime(0,0,0,date("m"),date("d")-33,date("Y"));

I am getting the current month, day, and year from the system.
I am subtracting 33 days from the current day.
The result is compared to a date value from the database.



Jef
-Original Message-
From: Ryan A [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 11, 2006 2:38 PM
To: php php
Subject: [PHP] Mktime formatting problems

Hey,

So far this is what I have done:
-
1) read the files from a directory, discard the files
with a  .php extention and the directories (eg: . and
.. )

2) put the files into an array ($the_files[])

3) put it into a while loop and display the files like
so:

echo $the_files[$i] . date("F d Y H:i:s.",
filectime($directory_with_files.$the_files[$i]));
-


The next step is, I want to only echo the files that
are over x minutes (or x hours) old, ignore anything
below, I am using mktime() along with date() to format
it accordingly...but am unable to do so.



Can someone kindly give me a quick example on how to
do this? sitting too long on the comp, I think i'm
losing it :-(

If you want the php file that i have written please
tell me and will send it to you offlist.

Thanks!
Ryan

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
-
Fight back spam! Download the Blue Frog.
http://www.bluesecurity.com/register/s?user=bXVzaWNndTc%3D

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
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



[PHP] include problem

2006-05-04 Thread Jef Sullivan
Greetings everyone,

 

Thanks for the help in advance.

PHP version is 4.3

 

I have set a variable and building a string that will be used later in
my php file.

The string is a table. Within this table I want to call another php file
using include for a

pulldown menu. The problem is the included file is not showing its
information. Snippets

are provided below...

 

 

SNIPPET of table string...

 

$post_payment_form = ' [SNIP]...



Full or Partial?











 

[SNIP]

';

 

GET_PAYMENT_TYPE.PHP code...

 

";

 

$payment_type_rs = get_payment_types();

if( $payment_type_rs )

{

while( $payment_type = mysql_fetch_assoc( $payment_type_rs )
)

{

sprintf( '%s',

 
$payment_type['stage_code_id'],

 
$payment_type['stage_code'] );

}

}

 

//clean up

if( $payment_type_rs )

mysql_free_result( $payment_type_rs );

 

 

?>

 

The result is an empty pulldown menu.

 

Suggestions?

 

 

Jef