Re: [PHP] regular expression

2010-06-02 Thread Richard Quadling
On 2 June 2010 06:12, Peter pet...@egrabber.com wrote:
 Hi  Tanel,

 1. only letters

 $str = 'helloworld';

 if(preg_match(/^[a-zA-Z]*$/,$str))
 echo only letters;
 else
 echo failed;

 2. only letters and spaces

 $str = 'hello world';

 if(preg_match(/^[a-zA-Z\s]*$/,$str))
 echo only letters and spaces;
 else
 echo failed;


 Regards
 Peter.M

Be careful with using *.

The issue of a zero length string is important.

* will allow a zero length string.

++ will force the regex to match something, so zero length strings are rejected.



/s will match space, formfeed, newline, carriage return, horizontal
tab, and vertical tab

So a string with newlines (for example a textarea with line breaks)
would match.





-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Credit Card encryption

2010-06-02 Thread Ashley Sheridan
On Tue, 2010-06-01 at 19:39 -0700, Michael Shadle wrote:

 Is this a joke?
 
 Better hope your merchant provider isn't lookin...
 
 
 On Jun 1, 2010, at 7:17 PM, Brandon Rampersad  
 brandon.add...@gmail.com wrote:
 
  I store CC # in plain text on my custom ecommerse website script so  
  i can
  compare it with others. That way it's easier to convert to different  
  hashes
  when i decide to integrate an encryption system. So far i havent had  
  any
  problems.
 
  On Tue, Jun 1, 2010 at 11:15 AM, Paul M Foster pa...@quillandmouse.com 
  wrote:
 
  On Tue, Jun 01, 2010 at 10:42:11AM -0400, tedd wrote:
 
  At 9:24 PM -0400 5/31/10, Paul M Foster wrote:
  On Mon, May 31, 2010 at 05:06:23PM -0400, tedd wrote:
 
  At 12:36 PM -0400 5/31/10, I wrote:
  That's Okay, but I'm simply telling you what I KNOW to be true.  
  You
  may either accept what I have to say, or reject it, but to reply
  that what I say is Not true is somewhat offensive and
  confrontational. I hope you didn't mean it that way. :-)
 
  My apologies for taking what you said as I did and my reply --  
  it was
  wrong of me. I am sure you didn't mean anything offensive.
 
  You are correct. I meant no offense. In turn, when I read your  
  post, it
  appeared that you were making a blanket statement applicable  
  under all
  conditions, to which I objected. However, reading back over it,  
  you did
  insert qualifiers.
 
  Paul
 
  Okay, let's not get a room over this.  :-)
 
  Yes, dear. ;-}
 
  Paul
 
  --
  Paul M. Foster
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
  -- 
  A Brandon_R Production
 


Yeah, I'm pretty sure this is illegal, and if it isn't in your country,
then it's sure gonna be against the terms and conditions of your
merchant provider.

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] strange problem of mysql_query

2010-06-02 Thread I am on the top of the world! Borlange University
hey, i have a sql string like below:
select szs_content from szs_gy_ca where szs_shengchanhao='09-s525' and
szs_guige='48B32/14-1 1/8' and szs_tuhao='48B32 1 1/8'

the problem is that using mysql_query to run this sql string returns
nothing,however, i can get one record through mysql query tool.

i was wondering whether the double quote 48B32/14-1 1/8 makes this trouble.


Re: [PHP] strange problem of mysql_query

2010-06-02 Thread Ashley Sheridan
On Wed, 2010-06-02 at 17:36 +0800, I am on the top of the world!
Borlange University wrote:

 hey, i have a sql string like below:
 select szs_content from szs_gy_ca where szs_shengchanhao='09-s525' and
 szs_guige='48B32/14-1 1/8' and szs_tuhao='48B32 1 1/8'
 
 the problem is that using mysql_query to run this sql string returns
 nothing,however, i can get one record through mysql query tool.
 
 i was wondering whether the double quote 48B32/14-1 1/8 makes this trouble.


The double quotes inside of that query won't cause any trouble, but you
haven't shown us how you're executing the query with PHP. The usual is
to do something like this:

$query = select szs_content from szs_gy_ca where
szs_shengchanhao='09-s525' and szs_guige='48B32/14-1 1/8\' and
szs_tuhao='48B32 1 1/8';
$result = mysql_query($query);

Note that the double quote there is escaped because you're already using
double quotes as the string identifier in PHP.

If that still doesn't give you the results you expect, it's more likely
a logic problem than a syntax issue.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] php accelorator

2010-06-02 Thread Dan Joseph
Cool, thanks for the tips, I am going to check them out.


-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code NEWTHINGS for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] php accelorator

2010-06-02 Thread Nilesh Govindarajan
If you're looking out for an accelerator then it means that you have a
custom server. Then I suggest, you use mod_fcgid with php-fcgi.
mod_fcgid uses the fastcgi protocol and also it serves the caching
part (that's the biggest difference between mod_fcgid and
mod_fastcgi).

-- 
Nilesh Govindarajan
Facebook: nilesh.gr
Twitter: nileshgr
Website: www.itech7.com
Cheap and Reliable VPS Hosting: http://j.mp/arHk5e

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



RE: [PHP] Set up MySQL + Apache 2.2.4 on Win XP.

2010-06-02 Thread Bob McConnell
From: Shreyas

 What would be the exact installer which will let me have the MySQL
Server
 and the Query browser? I know this is the wrong forum but I am just
giving
 it a shot. When I do Start - All Programs - MYSQL, I used to get
only
 above options. I have lost the installer and the actual MySQL website
has
 quite a lot of things.

I don't know anything about the MySQL toy, but from scanning this thread
you already have a server installed if your java app is talking to it on
port 3306. You are now trying to install a second server on the same
computer, which can only be done if you change the port number.

How did you install the first server? Was it part of the java install or
did one of the other packages you installed put it there? Do you still
have the documents for that package with the default users and
passwords?

Bob McConnell

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



Re: [PHP] strange problem of mysql_query

2010-06-02 Thread Jim Lucas

I am on the top of the world! Borlange University wrote:

hey, i have a sql string like below:
select szs_content from szs_gy_ca where szs_shengchanhao='09-s525' and
szs_guige='48B32/14-1 1/8' and szs_tuhao='48B32 1 1/8'

the problem is that using mysql_query to run this sql string returns
nothing,however, i can get one record through mysql query tool.

i was wondering whether the double quote 48B32/14-1 1/8 makes this trouble.



Break it down the basic of examples.

show us how you...

1. connect to mysql from php
2. select your database in mysql from php
3. prepare the SQL query
4. executing said query
5. collecting/displaying the results of executed query


As you can see, you gave us step 3.  The problem could be in any of the 
other setups.


--
Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

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



Re: [PHP] regular expression

2010-06-02 Thread Jan G.B.
2010/6/1 Peter Lind peter.e.l...@gmail.com:
 On 1 June 2010 17:33, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
 On Tue, 2010-06-01 at 16:31 +0100, Richard Quadling wrote:

 $re1 = '/^[a-z]++$/i';
 $re2 = '/^[a-z ]++$/i';



 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling



 Why the double ++ in the expressions there? Surely one + would match the
 1 or more characters that you need and the second one would just be
 surplus?


 Equally important: why have three people already done this persons
 homework. 5 minutes googling would have answered this ...


Even more important: No answer is correct, because f.e. äüßćéâ are
also letters.

Bye

;-)

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



Re: [PHP] regular expression

2010-06-02 Thread Richard Quadling
On 2 June 2010 16:35, Jan G.B. ro0ot.w...@googlemail.com wrote:
 2010/6/1 Peter Lind peter.e.l...@gmail.com:
 On 1 June 2010 17:33, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
 On Tue, 2010-06-01 at 16:31 +0100, Richard Quadling wrote:

 $re1 = '/^[a-z]++$/i';
 $re2 = '/^[a-z ]++$/i';



 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling



 Why the double ++ in the expressions there? Surely one + would match the
 1 or more characters that you need and the second one would just be
 surplus?


 Equally important: why have three people already done this persons
 homework. 5 minutes googling would have answered this ...


 Even more important: No answer is correct, because f.e. äüßćéâ are
 also letters.

 Bye

 ;-)


So, would ...

/^[^\p{M}\p{Z}\p{N}\p{P}\p{S}\p{C}\d\s]++$/i

be ok?



-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



[PHP] Preg Match Problem

2010-06-02 Thread Alice Wei

Hi, 

I have a code snippet here as in the following:

[CODE]
$keywords = preg_split(/[\s,]+/, $day);
$count = count($keywords);
  if(preg_match((Mon|Tue|Wed|Thu|Fri)/i, $keywords[$i])) { //line 40
   $day_query =start_time.day='12345' AND end_time.day='12345';  
   }  
   if(preg_match(Sat/i, $keywords[$i])) { //line 43
   $day_query = start_time.Sat_route != 'NULL' AND end_time.Sat_route != 
'NULL';
   }  
   else {
   echo $keywords[i] .  is not a term that exists in the database. Make sure 
the pattern looks like bMon, Tue/bbr /;
   footer();
   exit;
   }
[/CODE]

For some reason, when I type in Mon, Tue

It gives me this: 

Warning: preg_match() [function.preg-match]: Unknown modifier '/' in line 40
Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric 
or backslash on line 43
is not a term that exists in the database. Make sure the pattern looks like 
Mon, Tue

Have I done something wrong here?
Thanks for your help.
  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

Re: [PHP] Preg Match Problem

2010-06-02 Thread Peter Lind
On 2 June 2010 18:14, Alice Wei aj...@alumni.iu.edu wrote:

 Hi,

 I have a code snippet here as in the following:

 [CODE]
 $keywords = preg_split(/[\s,]+/, $day);
 $count = count($keywords);
  if(preg_match((Mon|Tue|Wed|Thu|Fri)/i, $keywords[$i])) { //line 40

You're lacking the starting delimiter '/'

Regards
Peter

-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
/hype

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



RE: [PHP] Preg Match Problem

2010-06-02 Thread Alice Wei


 From: peter.e.l...@gmail.com
 Date: Wed, 2 Jun 2010 18:17:00 +0200
 Subject: Re: [PHP] Preg Match Problem
 To: aj...@alumni.iu.edu
 CC: php-general@lists.php.net
 
 On 2 June 2010 18:14, Alice Wei aj...@alumni.iu.edu wrote:
 
  Hi,
 
  I have a code snippet here as in the following:
 
  [CODE]
  $keywords = preg_split(/[\s,]+/, $day);
  $count = count($keywords);
   if(preg_match((Mon|Tue|Wed|Thu|Fri)/i, $keywords[$i])) { //line 40
 
 You're lacking the starting delimiter '/'
 
 Regards
 Peter
 

Thanks, that did the trick. 

Alice

 -- 
 hype
 WWW: http://plphp.dk / http://plind.dk
 LinkedIn: http://www.linkedin.com/in/plind
 BeWelcome/Couchsurfing: Fake51
 Twitter: http://twitter.com/kafe15
 /hype
  
_
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccountocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

Re: [PHP] php accelorator

2010-06-02 Thread Robert Cummings

Lester Caine wrote:

Robert Cummings wrote:

Dan Joseph wrote:

Hi,

Are any of you using any of the php accelorators such as Zend,
Ioncube, or
any others? Any idea which is the best?

I am partial to eAccelerator for *nixes. And wincache for Windows.


eAccelerator works fine for me ... on linux and windows ...


I don't recall that eAccelerator works with PHP FastCGI in a windows 
environment -- the recommended configuration for PHP in a Windows 
environment.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



[PHP] Parse info from 1,000 files to file

2010-06-02 Thread Sam Smith
Can someone briefly point me to the functions I'll need to parse some
information from thousands of files in a single directory and then
prepare the extracted info into a single file for SQL import?

Like file() or readfile() and some regex and writefile??

Thanks

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



Re: [PHP] php accelorator

2010-06-02 Thread Lester Caine

Robert Cummings wrote:

Lester Caine wrote:

Robert Cummings wrote:

Dan Joseph wrote:

Hi,

Are any of you using any of the php accelorators such as Zend,
Ioncube, or
any others? Any idea which is the best?

I am partial to eAccelerator for *nixes. And wincache for Windows.


eAccelerator works fine for me ... on linux and windows ...


I don't recall that eAccelerator works with PHP FastCGI in a windows
environment -- the recommended configuration for PHP in a Windows
environment.


That may be what people are trying to ram down our throuts! But I have had 
eaccelerator running on PHP5.x for many years without any problem and I do not 
intend changing that configuration for anybody. I have a matching setup on my 
linux servers as my windows servers and will maintain that even if it does mean 
ditching PHP5.3 in production ;)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



Re: [PHP] php accelorator

2010-06-02 Thread Robert Cummings

Lester Caine wrote:

Robert Cummings wrote:

Lester Caine wrote:

Robert Cummings wrote:

Dan Joseph wrote:

Hi,

Are any of you using any of the php accelorators such as Zend,
Ioncube, or
any others? Any idea which is the best?

I am partial to eAccelerator for *nixes. And wincache for Windows.

eAccelerator works fine for me ... on linux and windows ...

I don't recall that eAccelerator works with PHP FastCGI in a windows
environment -- the recommended configuration for PHP in a Windows
environment.


That may be what people are trying to ram down our throuts! But I have had 
eaccelerator running on PHP5.x for many years without any problem and I do not 
intend changing that configuration for anybody. I have a matching setup on my 
linux servers as my windows servers and will maintain that even if it does mean 
ditching PHP5.3 in production ;)


I use FastCGI and the NTS version of PHP in Windows because that is the 
configuration recommended by PHP on their website. After experiencing 
the instability of PHP as relates to the module version in Windows 
(using eAccelerator at the time), I switched to FastCGI NTS as 
recommended and then had to hunt down an appropriate accelerator. 
Wincache was in beta at the time and worked very well. As such it is my 
recommended accelerator for Windows since it works with PHP FastCGI and 
works well.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] Set up MySQL + Apache 2.2.4 on Win XP.

2010-06-02 Thread Shreyas
Bob,

That was a separate installer. It was nothing to do with another software.

--Shreyas

On Wed, Jun 2, 2010 at 7:19 PM, Bob McConnell r...@cbord.com wrote:

 From: Shreyas

  What would be the exact installer which will let me have the MySQL
 Server
  and the Query browser? I know this is the wrong forum but I am just
 giving
  it a shot. When I do Start - All Programs - MYSQL, I used to get
 only
  above options. I have lost the installer and the actual MySQL website
 has
  quite a lot of things.

 I don't know anything about the MySQL toy, but from scanning this thread
 you already have a server installed if your java app is talking to it on
 port 3306. You are now trying to install a second server on the same
 computer, which can only be done if you change the port number.

 How did you install the first server? Was it part of the java install or
 did one of the other packages you installed put it there? Do you still
 have the documents for that package with the default users and
 passwords?

 Bob McConnell




-- 
Regards,
Shreyas


[PHP] Inserting, storing, outputting dates and selections

2010-06-02 Thread David Mehler
Hello,
I've got two questions which are probably fairly simple, my issue is
i'm staring at this so long it's blurring together.
I'm working on a form to insert data in to a mysql database. I've got
a startdate and and enddate field in the database both of type DATE,
i'm needing this as i'm wanting to do a calculation against the date
and only display records greater than or equal to the current date. My
understanding is dates have to be entered as 2010-06-02 with this
format.
I'm having several issues: the first of which is I entered a date as
probably a user would as June 2, 2010 and on the display page got all
zeroes, is there a way i can be more flexible with my data entry,
enter it, then store it in the format mysql needs?
My second issue is that the startdate field is NOT NULL while the
enddate field is. On submission I only want those forms that are
actually in the post data to get inserted in to the database, and
displayed, i.e. if enddate was not entered I shouldn't see all zeroes
in the field in the database, if using the mysql commandline client,
or all zeroes in displayed output. I'm not sure how to conditionally
insert or display a field based on whether it's set.
My last issue, not on dates, is on a selection box. I've got two
choices to choose from, choice1 and choice2 just for this example. If
a user goes through and selects nothing I want choice1 to be
automatically selected on form submission, if a user selects choice2
then the form should go with that. Here's my code.

div
label for=txtchooseChoose*:/label
select name=Choice for Selection
option - choice1 - /option
option - choice2 - /option
/select
/div

On form submission the php script processes it and enters an empty
field in the database if the user doesn't select an option.
Thanks.
Dave.

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



Re: [PHP] Inserting, storing, outputting dates and selections

2010-06-02 Thread Shreyas
I can try to answer the second one but would wait for the PHP gurus to chime
in.

Can't you have Choice=1 with selected=true by default? On the PHP end, you
can get the value of whatever was selected.

Regards,
Shreyas

On Thu, Jun 3, 2010 at 1:50 AM, David Mehler dave.meh...@gmail.com wrote:

 Hello,
 I've got two questions which are probably fairly simple, my issue is
 i'm staring at this so long it's blurring together.
I'm working on a form to insert data in to a mysql database. I've
 got
 a startdate and and enddate field in the database both of type DATE,
 i'm needing this as i'm wanting to do a calculation against the date
 and only display records greater than or equal to the current date. My
 understanding is dates have to be entered as 2010-06-02 with this
 format.
I'm having several issues: the first of which is I entered a date as
 probably a user would as June 2, 2010 and on the display page got all
 zeroes, is there a way i can be more flexible with my data entry,
 enter it, then store it in the format mysql needs?
 My second issue is that the startdate field is NOT NULL while the
 enddate field is. On submission I only want those forms that are
 actually in the post data to get inserted in to the database, and
 displayed, i.e. if enddate was not entered I shouldn't see all zeroes
 in the field in the database, if using the mysql commandline client,
 or all zeroes in displayed output. I'm not sure how to conditionally
 insert or display a field based on whether it's set.
 My last issue, not on dates, is on a selection box. I've got two
 choices to choose from, choice1 and choice2 just for this example. If
 a user goes through and selects nothing I want choice1 to be
 automatically selected on form submission, if a user selects choice2
 then the form should go with that. Here's my code.

 div
 label for=txtchooseChoose*:/label
 select name=Choice for Selection
 option - choice1 - /option
 option - choice2 - /option
 /select
 /div

 On form submission the php script processes it and enters an empty
 field in the database if the user doesn't select an option.
 Thanks.
 Dave.

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




-- 
Regards,
Shreyas


Re: [PHP] Inserting, storing, outputting dates and selections

2010-06-02 Thread Andre Polykanine
Hi Dave,

Let's look and see)
1. You can re-format your date so that it will fit the needed format
for MySql:
$_POST['EndDate']=date(Y-m-d, $_POST['EndDate']);

 2. There's a PHP
 function called
 isset() that checks
 whether a variable is
 set. But you probably
 will find this one
 much handier:
if (!empty($_POST['EndDate'])) {
// blahblah, inserting into database
}

3. This is quite simple, I think. You write:
optionChoice 1/option
What would you like PHP to write in the DB? It has nothing to write at
all) You should do this instead:
option value=1Choice 1/option
option value=2Choice 2/option

So now you have values to insert)
Hope I could help you!)

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: David Mehler dave.meh...@gmail.com
To: php-general php-general@lists.php.net
Date: Wednesday, June 2, 2010, 11:20:55 PM
Subject: [PHP] Inserting, storing, outputting dates and selections

Hello,
I've got two questions which are probably fairly simple, my issue is
i'm staring at this so long it's blurring together.
I'm working on a form to insert data in to a mysql database. I've got
a startdate and and enddate field in the database both of type DATE,
i'm needing this as i'm wanting to do a calculation against the date
and only display records greater than or equal to the current date. My
understanding is dates have to be entered as 2010-06-02 with this
format.
I'm having several issues: the first of which is I entered a date as
probably a user would as June 2, 2010 and on the display page got all
zeroes, is there a way i can be more flexible with my data entry,
enter it, then store it in the format mysql needs?
My second issue is that the startdate field is NOT NULL while the
enddate field is. On submission I only want those forms that are
actually in the post data to get inserted in to the database, and
displayed, i.e. if enddate was not entered I shouldn't see all zeroes
in the field in the database, if using the mysql commandline client,
or all zeroes in displayed output. I'm not sure how to conditionally
insert or display a field based on whether it's set.
My last issue, not on dates, is on a selection box. I've got two
choices to choose from, choice1 and choice2 just for this example. If
a user goes through and selects nothing I want choice1 to be
automatically selected on form submission, if a user selects choice2
then the form should go with that. Here's my code.

div
label for=txtchooseChoose*:/label
select name=Choice for Selection
option - choice1 - /option
option - choice2 - /option
/select
/div

On form submission the php script processes it and enters an empty
field in the database if the user doesn't select an option.
Thanks.
Dave.

-- 
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] Parse info from 1,000 files to file

2010-06-02 Thread Andre Polykanine
Hello Sam,

Consider using opendir(), readdir(), fopen(), file_get_contents(),
fwrite().
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Sam Smith s...@ssmith.com
To: php-general@lists.php.net php-general@lists.php.net
Date: Wednesday, June 2, 2010, 9:24:20 PM
Subject: [PHP] Parse info from 1,000 files to file

Can someone briefly point me to the functions I'll need to parse some
information from thousands of files in a single directory and then
prepare the extracted info into a single file for SQL import?

Like file() or readfile() and some regex and writefile??

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] php accelorator

2010-06-02 Thread Lester Caine

Robert Cummings wrote:

I use FastCGI and the NTS version of PHP in Windows because that is the
configuration recommended by PHP on their website. After experiencing
the instability of PHP as relates to the module version in Windows
(using eAccelerator at the time), I switched to FastCGI NTS as
recommended and then had to hunt down an appropriate accelerator.
Wincache was in beta at the time and worked very well. As such it is my
recommended accelerator for Windows since it works with PHP FastCGI and
works well.


Well I have no problem with my own configuration being unstable - in some 5 
years of use. So that would appear to suggest you are using something that has a 
problem which I am not. I also have only ever used TS version again without any 
stability problems.


Part of the problem here is people saying It does not work but not actually 
helping to identify WHAT does not work :(


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



Re: [PHP] php accelorator

2010-06-02 Thread Robert Cummings

Lester Caine wrote:

Robert Cummings wrote:

I use FastCGI and the NTS version of PHP in Windows because that is the
configuration recommended by PHP on their website. After experiencing
the instability of PHP as relates to the module version in Windows
(using eAccelerator at the time), I switched to FastCGI NTS as
recommended and then had to hunt down an appropriate accelerator.
Wincache was in beta at the time and worked very well. As such it is my
recommended accelerator for Windows since it works with PHP FastCGI and
works well.


Well I have no problem with my own configuration being unstable - in some 5 
years of use. So that would appear to suggest you are using something that has a 
problem which I am not. I also have only ever used TS version again without any 
stability problems.


Part of the problem here is people saying It does not work but not actually 
helping to identify WHAT does not work :(


I just realized btw... I haven't mentioned that the recommendation is 
for IIS in Windows... bleh. I don't think the problem exists when using 
Apache under windows. We were forced to use IIS in this particular case 
due to Government department policy.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



[PHP] preg_replace insert newline

2010-06-02 Thread Sam Smith
$string = 'text with no newline';
$pattern = '/(.*)/';
$replacement = '${1}XX\nNext line';
$string = preg_replace($pattern, $replacement, $string);
echo $string;

Outputs:
text with no newlineXX\nNext line
Instead of:
text with no newlineXX
Next line

How does one insert a newline with preg_replace?

Thanks

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



Re: [PHP] php accelorator

2010-06-02 Thread Lester Caine

Robert Cummings wrote:

Lester Caine wrote:

Robert Cummings wrote:

I use FastCGI and the NTS version of PHP in Windows because that is the
configuration recommended by PHP on their website. After experiencing
the instability of PHP as relates to the module version in Windows
(using eAccelerator at the time), I switched to FastCGI NTS as
recommended and then had to hunt down an appropriate accelerator.
Wincache was in beta at the time and worked very well. As such it is my
recommended accelerator for Windows since it works with PHP FastCGI and
works well.


Well I have no problem with my own configuration being unstable - in
some 5 years of use. So that would appear to suggest you are using
something that has a problem which I am not. I also have only ever
used TS version again without any stability problems.

Part of the problem here is people saying It does not work but not
actually helping to identify WHAT does not work :(


I just realized btw... I haven't mentioned that the recommendation is
for IIS in Windows... bleh. I don't think the problem exists when using
Apache under windows. We were forced to use IIS in this particular case
due to Government department policy.


You have my sympathies ;)

We established early on that IIS was unsuitable for the type of sites were run 
and have never had any problem convincing customers of the facts. MANY of them 
have now moved the web servers to Linux simply to remove windows from the 
equation, and THEY were insisting that Windows servers were not negotiable 5 
years ago! How times change 


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



[PHP] Re: preg_replace insert newline

2010-06-02 Thread Shawn McKenzie
On 06/02/2010 04:28 PM, Sam Smith wrote:
 $string = 'text with no newline';
 $pattern = '/(.*)/';
 $replacement = '${1}XX\nNext line';
 $string = preg_replace($pattern, $replacement, $string);
 echo $string;
 
 Outputs:
 text with no newlineXX\nNext line
 Instead of:
 text with no newlineXX
 Next line
 
 How does one insert a newline with preg_replace?
 
 Thanks

http://us.php.net/manual/en/language.types.string.php

Pay attention to single and double.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Set up MySQL + Apache 2.2.4 on Win XP

2010-06-02 Thread Shreyas
All,

Finally, the 28th reply seems to have brought this thread to an end. Yes,
persistence finally got me there! Special thanks to Ash.

I am able to run both my Java code and php code on the same port (though
nothing database conversations are happening) from the same machine.

Here's the set-up :

MySQL Server 5.1 + Query Browser : port 3306. This has a schema called as NS
which is referenced by my Java code.

EasyPHP : This is running in a diferent location with its stack in C:\.

Fix : I knew all I had to do was a drop of my NS schema to a folder called
data and from nowhere I crashed into this : C:\Documents and Settings\All
Users\Application Data\MySQL\MySQL Server 5.1\data.

I dropped my NS schema there; checked the query browser and there it was!
Compiled my Java code and I was able to get back to my previous
environment.

So, no port conflicts, no different usernames. So far so good. Talk to you
all soon as I am gearing up with programming questions now.

--Shreyas

On Thu, Jun 3, 2010 at 1:02 AM, Shreyas shreya...@gmail.com wrote:

 Bob,

 That was a separate installer. It was nothing to do with another software.

 --Shreyas


 On Wed, Jun 2, 2010 at 7:19 PM, Bob McConnell r...@cbord.com wrote:

 From: Shreyas

  What would be the exact installer which will let me have the MySQL
 Server
  and the Query browser? I know this is the wrong forum but I am just
 giving
  it a shot. When I do Start - All Programs - MYSQL, I used to get
 only
  above options. I have lost the installer and the actual MySQL website
 has
  quite a lot of things.

 I don't know anything about the MySQL toy, but from scanning this thread
 you already have a server installed if your java app is talking to it on
 port 3306. You are now trying to install a second server on the same
 computer, which can only be done if you change the port number.

 How did you install the first server? Was it part of the java install or
 did one of the other packages you installed put it there? Do you still
 have the documents for that package with the default users and
 passwords?

 Bob McConnell




 --
 Regards,
 Shreyas




-- 
Regards,
Shreyas


Re: [PHP] Set up MySQL + Apache 2.2.4 on Win XP

2010-06-02 Thread shiplu
Actually you just restore your NS schema in the new EasyPHP stack.

Shiplu Mokadd.im
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

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



Re: [PHP] php accelorator

2010-06-02 Thread Ashley Sheridan
On Wed, 2010-06-02 at 22:38 +0100, Lester Caine wrote:

 Robert Cummings wrote:
  Lester Caine wrote:
  Robert Cummings wrote:
  I use FastCGI and the NTS version of PHP in Windows because that is the
  configuration recommended by PHP on their website. After experiencing
  the instability of PHP as relates to the module version in Windows
  (using eAccelerator at the time), I switched to FastCGI NTS as
  recommended and then had to hunt down an appropriate accelerator.
  Wincache was in beta at the time and worked very well. As such it is my
  recommended accelerator for Windows since it works with PHP FastCGI and
  works well.
 
  Well I have no problem with my own configuration being unstable - in
  some 5 years of use. So that would appear to suggest you are using
  something that has a problem which I am not. I also have only ever
  used TS version again without any stability problems.
 
  Part of the problem here is people saying It does not work but not
  actually helping to identify WHAT does not work :(
 
  I just realized btw... I haven't mentioned that the recommendation is
  for IIS in Windows... bleh. I don't think the problem exists when using
  Apache under windows. We were forced to use IIS in this particular case
  due to Government department policy.
 
 You have my sympathies ;)
 
 We established early on that IIS was unsuitable for the type of sites were 
 run 
 and have never had any problem convincing customers of the facts. MANY of 
 them 
 have now moved the web servers to Linux simply to remove windows from the 
 equation, and THEY were insisting that Windows servers were not negotiable 5 
 years ago! How times change 
 
 -- 
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk//
 Firebird - http://www.firebirdsql.org/index.php
 

off-topic/

It's odd sometimes how a lot of public sectors seem to shy away from
open source software for one reason or another. I've heard people say
they don't trust free software as there's nobody to call when something
goes wrong (by someone arguing the merits of MS Office over OpenOffice,
because MS have never done anything that locked people out of their own
protected documents before
http://www.channelregister.co.uk/2009/07/31/office_for_mac_service_pack_woes/ )

I've even heard people say Firefox wasn't trustworthy software, and was
essentially a trojan (this from a school ICT technician) for malware.

I'm not sure who's feeding this disinformation to the public sector, but
I could take a few guesses...

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] php accelorator

2010-06-02 Thread Nilesh Govindarajan
On Thu, Jun 3, 2010 at 6:01 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 On Wed, 2010-06-02 at 22:38 +0100, Lester Caine wrote:

 Robert Cummings wrote:
  Lester Caine wrote:
  Robert Cummings wrote:
  I use FastCGI and the NTS version of PHP in Windows because that is the
  configuration recommended by PHP on their website. After experiencing
  the instability of PHP as relates to the module version in Windows
  (using eAccelerator at the time), I switched to FastCGI NTS as
  recommended and then had to hunt down an appropriate accelerator.
  Wincache was in beta at the time and worked very well. As such it is my
  recommended accelerator for Windows since it works with PHP FastCGI and
  works well.
 
  Well I have no problem with my own configuration being unstable - in
  some 5 years of use. So that would appear to suggest you are using
  something that has a problem which I am not. I also have only ever
  used TS version again without any stability problems.
 
  Part of the problem here is people saying It does not work but not
  actually helping to identify WHAT does not work :(
 
  I just realized btw... I haven't mentioned that the recommendation is
  for IIS in Windows... bleh. I don't think the problem exists when using
  Apache under windows. We were forced to use IIS in this particular case
  due to Government department policy.

 You have my sympathies ;)

 We established early on that IIS was unsuitable for the type of sites were 
 run
 and have never had any problem convincing customers of the facts. MANY of 
 them
 have now moved the web servers to Linux simply to remove windows from the
 equation, and THEY were insisting that Windows servers were not negotiable 5
 years ago! How times change 

 --
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk//
 Firebird - http://www.firebirdsql.org/index.php


 off-topic/

 It's odd sometimes how a lot of public sectors seem to shy away from
 open source software for one reason or another. I've heard people say
 they don't trust free software as there's nobody to call when something
 goes wrong (by someone arguing the merits of MS Office over OpenOffice,
 because MS have never done anything that locked people out of their own
 protected documents before
 http://www.channelregister.co.uk/2009/07/31/office_for_mac_service_pack_woes/ 
 )

 I've even heard people say Firefox wasn't trustworthy software, and was
 essentially a trojan (this from a school ICT technician) for malware.

 I'm not sure who's feeding this disinformation to the public sector, but
 I could take a few guesses...

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk




off-topic

Yeah Yeah, I know some such samplepieces. Such people are usually
found in very rich households, at least in my country (India).
Recently my friend's dad's computer was infected with virus it seems,
and he was using QuickHeal antivirus which is worst !
And he says, he doesn't trust free products when I suggested use of
Avast one of the best !
That was big OMG for me !!

-- 
Nilesh Govindarajan
Facebook: nilesh.gr
Twitter: nileshgr
Website: www.itech7.com
Cheap and Reliable VPS Hosting: http://j.mp/arHk5e

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