[PHP] IMAP connect problem

2004-05-19 Thread Haseeb Iqbal
hi all,
when i try to connect to imap server i get this and the script aborts.

what should i do to fix.

Certificate failure for localhost: self signed certificate: /C=US/ST=NY/L=New 
York/O=Courier Mail Server/OU=Automatically-generated IMAP SSL key/CN=localhost/[EMAIL 
PROTECTED]

consider myself a newbie in the world of linux.

Haseeb

[PHP] Fatal error help

2004-05-19 Thread robi
hello
I am programing a simple chat and I am using my own classes
and I get this error I have no idea what it is.
pls help.

Fatal error: Cannot redeclare class ch in /var/www/html/class/common.php on 
line 3

troby

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



Re: [PHP] Fatal error help

2004-05-19 Thread Haseeb Iqbal
the class you are defining is already or the file in which you have defined
the class in somehow included twice..
consider using require_once for you class include file.

HTH,
Haseeb
- Original Message - 
From: "robi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 19, 2004 1:15 PM
Subject: [PHP] Fatal error help


> hello
> I am programing a simple chat and I am using my own classes
> and I get this error I have no idea what it is.
> pls help.
>
> Fatal error: Cannot redeclare class ch in /var/www/html/class/common.php
on
> line 3
>
> troby
>
> -- 
> 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] Fatal error help

2004-05-19 Thread robi
thanks
it helped
troby

> the class you are defining is already or the file in which you have defined
> the class in somehow included twice..
> consider using require_once for you class include file.
>
> HTH,
> Haseeb
> - Original Message -
> From: "robi" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, May 19, 2004 1:15 PM
> Subject: [PHP] Fatal error help
>
> > hello
> > I am programing a simple chat and I am using my own classes
> > and I get this error I have no idea what it is.
> > pls help.
> >
> > Fatal error: Cannot redeclare class ch in /var/www/html/class/common.php
>
> on
>
> > line 3
> >
> > troby
> >
> > --
> > 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] shared memory

2004-05-19 Thread venkata ramana
Is the shared memory created with php comaptible with that created
with a C program? I mean to ask, can we access the data written into
shared memory by a C program from a php program?

Thanks,
ramana.

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



Re: [PHP] shared memory

2004-05-19 Thread Burhan Khalid
venkata ramana wrote:
Is the shared memory created with php comaptible with that created
with a C program? I mean to ask, can we access the data written into
shared memory by a C program from a php program?
I would hope not, as this would cause major security problems and system 
instability.

I *believe* once memory has been allocated to a program, it is for its 
exclusive use unless released.  Two programs cannot share the same stack 
space.

You would also be compromising the data that's in the shared space.
Burhan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] IF statement question...

2004-05-19 Thread Tristan . Pretty
Is it possible to request that a string CONTAINS another string...?

EG:
$string = "1, 2, 3, 7, 8, 9";
if ($string CONTAINS "7") {
// Do stuff
}

*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***

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



RE: [PHP] IF statement question...

2004-05-19 Thread Jay Blanchard
[snip]
Is it possible to request that a string CONTAINS another string...?

EG:
$string = "1, 2, 3, 7, 8, 9";
if ($string CONTAINS "7") {
// Do stuff
}
[/snip]

Almost any regex function would work here, for instance

$string = "1, 2, 3, 7, 8, 9";
if (preg_match("/7/", $string)){ //evaluates to true
// Do stuff
}

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



Re: [PHP] IF statement question...

2004-05-19 Thread Oliver Hankeln
[EMAIL PROTECTED] wrote:
Is it possible to request that a string CONTAINS another string...?
EG:
$string = "1, 2, 3, 7, 8, 9";
if ($string CONTAINS "7") {
// Do stuff
}
int strpos ( string haystack, string needle [, int offset])
is what you are looking for.
HTH,
Oliver Hankeln
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] IF statement question...

2004-05-19 Thread Ford, Mike [LSS]
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] 
> Sent: 19 May 2004 12:55
> 
> Is it possible to request that a string CONTAINS another string...?
> 
> EG:
> $string = "1, 2, 3, 7, 8, 9";
> if ($string CONTAINS "7") {
> // Do stuff
> }

   if (strpos($string, "7")!==FALSE)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services, JG125, James Graham 
Building, Leeds Metropolitan University, Headingley Campus, LEEDS,  LS6 3QS,  United 
Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



Re: [PHP] IF statement question...

2004-05-19 Thread Oliver Hankeln
Jay Blanchard wrote:
[snip]
Is it possible to request that a string CONTAINS another string...?
EG:
$string = "1, 2, 3, 7, 8, 9";
if ($string CONTAINS "7") {
// Do stuff
}
[/snip]
Almost any regex function would work here, for instance
$string = "1, 2, 3, 7, 8, 9";
if (preg_match("/7/", $string)){ //evaluates to true
// Do stuff
}
From php.net:
Tipp:  Do not use preg_match() if you only want to check if one string 
is contained in another string. Use strpos() or strstr() instead as they 
will be faster.

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


RE: [PHP] IF statement question...

2004-05-19 Thread Jay Blanchard
[snip]
Tipp:  Do not use preg_match() if you only want to check if one string 
is contained in another string. Use strpos() or strstr() instead as they

will be faster.
[/snip]


This brings up a good point. Just exactly how much faster would one be
over another in this small example? How big would the string have to be
to note any degredation of performance?

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



Re: [PHP] IF statement question...

2004-05-19 Thread Oliver Hankeln
Jay Blanchard wrote:
[snip]
Tipp:  Do not use preg_match() if you only want to check if one string 
is contained in another string. Use strpos() or strstr() instead as they

will be faster.
[/snip]
This brings up a good point. Just exactly how much faster would one be
over another in this small example? How big would the string have to be
to note any degredation of performance?
I wrote a small script to test this:
10 Searches in a rather small string took
0.38s with strpos() and 0.55s with preg_match()
While this is not too much in absolute time preg_match
uses 145% of the strpos time.
You can play with the script:

$haystack="This is a string. It is not really long, but I hope it is 
long enough for this test ;-)";
$needle="test";

function getmicrotime()
{
$time=microtime();
list($usec, $sec) = explode(" ", $time);
return ((float)$usec + (float)$sec);
}
$t1=getmicrotime();
for($i=0;$i<10;$i++)
$pos=strpos($haystack,$needle);
$t2=getmicrotime();
for($i=0;$i<10;$i++)
preg_match("/".$needle."/",$haystack);
$t3=getmicrotime();
printf("Time for strpos: %1.2f s",$t2-$t1);
printf("Time for preg_match: %1.2f s",$t3-$t2);
?>
Oliver
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Distance and info

2004-05-19 Thread Brent Clark
Hi all

I have a question regarding phpclasses.org.

There is a section, where is says, "Find the closest mirror".

My question is, does anyone know how do they determine the distance (Sits on
the right of the screen) and also
the details for "Your approximate location".
Cause its pretty acurrate.

Kind Regards
Brent Clark

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



[PHP] Re: Distance and info

2004-05-19 Thread Craig
Probably useing something like this, not altogether sure.
http://www.maxmind.com/geoip/

"Brent Clark" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all
>
> I have a question regarding phpclasses.org.
>
> There is a section, where is says, "Find the closest mirror".
>
> My question is, does anyone know how do they determine the distance (Sits
on
> the right of the screen) and also
> the details for "Your approximate location".
> Cause its pretty acurrate.
>
> Kind Regards
> Brent Clark

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



Re: [PHP] shared memory

2004-05-19 Thread venkata ramana
Thanks for your reply, but I afraid you did not get my point. I am
talking about shared memory that is used for Interprocess
communication. We can access the shared memory created by one C
program in other C program and same is the case with php. I am trying
to communicate with a C program from php using shared memory, but I
did not get it working till now.

To be more specific, I want to know
1. Are calls to function ftok() return the same key in both php and C
2. Is the function shmop_open() return the same shared memory as
shmget() system call, when we pass the same key to both the functions.
Thanks in advance
ramana.

On Wed, 19 May 2004 15:00:02 +0300, Burhan Khalid <[EMAIL PROTECTED]> wrote:
> 
> 
> venkata ramana wrote:
> > Is the shared memory created with php comaptible with that created
> > with a C program? I mean to ask, can we access the data written into
> > shared memory by a C program from a php program?
> 
> I would hope not, as this would cause major security problems and system
> instability.
> 
> I *believe* once memory has been allocated to a program, it is for its
> exclusive use unless released.  Two programs cannot share the same stack
> space.
> 
> You would also be compromising the data that's in the shared space.
> 
> Burhan
>

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



Re: [PHP] Distance and info

2004-05-19 Thread John Nichel
Brent Clark wrote:
Hi all
I have a question regarding phpclasses.org.
There is a section, where is says, "Find the closest mirror".
My question is, does anyone know how do they determine the distance (Sits on
the right of the screen) and also
the details for "Your approximate location".
Cause its pretty acurrate.
Kind Regards
Brent Clark
Based on your IP, you can get sometimes get the location.  It's not 100% 
accurate with all the proxies out there.

--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] IF statement question...

2004-05-19 Thread Curt Zirzow
* Thus wrote Oliver Hankeln ([EMAIL PROTECTED]):
> Jay Blanchard wrote:
> 
> >[snip]
> >Tipp:  Do not use preg_match() if you only want to check if one string 
> >is contained in another string. Use strpos() or strstr() instead as they
> >
> >will be faster.
> >[/snip]
> >
> >
> >This brings up a good point. Just exactly how much faster would one be
> >over another in this small example? How big would the string have to be
> >to note any degredation of performance?
> 
> I wrote a small script to test this:
> 
> 10 Searches in a rather small string took
> 0.38s with strpos() and 0.55s with preg_match()
> ...
> 
> $t1=getmicrotime();
> for($i=0;$i<10;$i++)
> $pos=strpos($haystack,$needle);
> $t2=getmicrotime();
> for($i=0;$i<10;$i++)
> preg_match("/".$needle."/",$haystack);
> $t3=getmicrotime();

Make sure your benchmarks aren't bias:
  - assignment takes time
  - concating string takes time


  strpos($haystack,$needle);

  v.s.

  preg_match($regex,$haystack);


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] IF statement question...

2004-05-19 Thread Oliver Hankeln
Curt Zirzow wrote:
* Thus wrote Oliver Hankeln ([EMAIL PROTECTED]):

10 Searches in a rather small string took
0.38s with strpos() and 0.55s with preg_match()

Make sure your benchmarks aren't bias:
  - assignment takes time
  - concating string takes time
You are right. I updated the script to:
[...]
$regexp="/".$needle."/";
$t1=getmicrotime();
for($i=0;$i<10;$i++)
strpos($haystack,$needle);
$t2=getmicrotime();
for($i=0;$i<10;$i++)
preg_match($regexp,$haystack);
$t3=getmicrotime();
[...]
Now the time is 0.33s vs. 0.46s.
preg_match needs 139.4% of the strpos time
Oliver
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] IF statement question...

2004-05-19 Thread Tristan . Pretty
If I'm being Dumb, I apologies...
but When using this:

$row[bands] = "1,2,3,4,5,6,7,8";
$row2[id] = "7";
if (strpos($row[bands], $row2[id]) != FALSE) {
// do stuff
}

I get the No 13 (as it's inthe 13th place in the string) as my result.

Now I'm aware that it should work, as it's not returning a false value...
But I'm still not getting the correct output on my page...

Any other ideas?






Oliver Hankeln <[EMAIL PROTECTED]> 
19/05/2004 15:49

To
[EMAIL PROTECTED]
cc

Subject
Re: [PHP] IF statement question...






Curt Zirzow wrote:

> * Thus wrote Oliver Hankeln ([EMAIL PROTECTED]):

>>10 Searches in a rather small string took
>>0.38s with strpos() and 0.55s with preg_match()

> 
> Make sure your benchmarks aren't bias:
>   - assignment takes time
>   - concating string takes time

You are right. I updated the script to:
[...]
$regexp="/".$needle."/";
$t1=getmicrotime();
for($i=0;$i<10;$i++)
 strpos($haystack,$needle);
$t2=getmicrotime();
for($i=0;$i<10;$i++)
 preg_match($regexp,$haystack);
$t3=getmicrotime();
[...]

Now the time is 0.33s vs. 0.46s.
preg_match needs 139.4% of the strpos time

Oliver

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





*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***


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



RE: [PHP] IF statement question...

2004-05-19 Thread Jay Blanchard
[snip]
If I'm being Dumb, I apologies...
but When using this:

$row[bands] = "1,2,3,4,5,6,7,8";
$row2[id] = "7";
if (strpos($row[bands], $row2[id]) != FALSE) {
// do stuff
}
[/snip]

What is the expected output?

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



[PHP] Date Function - Empty Value

2004-05-19 Thread Gabe
Environment:
PHP 4.3.6
Access DB
W2K IIS 5
I'm trying to store a date in a date/time field using the short date 
format ( m/d/ ).  For some reason it won't let me post an empty 
value to that field in the DB.  I've tried using empty quotes ( "" ) or 
NULL and I always get a datatype mismatch sql error.  So then I just 
tried submitting a date that will never be used ( e.g. 1/1/ ).  That 
works, but then when I try to read the date out of the field in the DB 
and format it using the date() function in PHP it doesn't display 
anything (which is fine with me).  I read up on the date function on the 
PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on 
windows machines.  So that explains why the function returns nothing.

So, I guess my question is this:  Is what I'm doing technically ok 
(using a date that's not in the valid range)?  Or does anyone know of an 
empty date value that I can submit to the DB?

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


Re: [PHP] IF statement question...

2004-05-19 Thread John Nichel
Curt Zirzow wrote:
Make sure your benchmarks aren't bias:
  - assignment takes time
  - concating string takes time
  strpos($haystack,$needle);
  v.s.
  preg_match($regex,$haystack);
Just for shits and giggles (and because it's a slow work day), the below 
script output this...

strpos() : 0.18918436765671
preg_match() : 0.26665662288666
ini_set ( "max_execution_time", "72000" );
function getmicrotime() {
   list ( $usec, $sec ) = explode( " ", microtime() );
   return ( (float)$usec + (float)$sec );
}
$haystack= "Bob is good.";
$needle = "is";
$regex = "/is/";
$strpos_temp = 0;
$preg_match_temp = 0;
for ( $j = 0; $j < 1; $j++ ) {
	$t1 = getmicrotime();
	for ( $i = 0; $i < 10; $i++ ) {
		$pos = strpos ( $haystack, $needle );
	}
	$t2 = getmicrotime();
	for ( $i = 0; $i < 10; $i++ ) {
		preg_match ( $regex, $haystack );
	}
	$t3 = getmicrotime();
	$strpos_temp += $t2 - $t1;
	$preg_match_temp += $t3 - $t2;
}
$strpos = $strpos_temp / $j;
$preg_match = $preg_match_temp / $j;
echo ( "strpos() : " . $strpos . "\npreg_match() : " . $preg_match 
. "\n" );

--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] executing php scripts via cron

2004-05-19 Thread raditha dissanayake
Merlin wrote:
Hi there,
I am trying to run a php script via cron. Problem is, that it does not 
work if I include the whole path in crontab

Currently it looks like:
0 6 * * * php /home/www/project/app_cron/follow_up_new_members.php > 
/dev/null
does typing in php /home/www/project/app_cron/follow_up_new_members.php 
> /dev/null
at the command line work for you?

Most likeley because the webserver root for the project is:
/home/www/project/
Are you sure the directory permissions are correct? sometimes when you 
tighten security you run into situations like this.

--
Raditha Dissanayake.
-
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] IF statement question...

2004-05-19 Thread Jay Blanchard
[snip]
strpos() : 0.18918436765671
preg_match() : 0.26665662288666
[/snip]

1/3rd of a second slowerinteresting. You know what though, my
original assertion is correctalmost any of the regex functions will
work.

Tristan, why not convert the string to an array and then use in_array()?
John, can you add the array speed test to your script? I'd like to know
how that stacks up too.

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



RE: [PHP] IF statement question...

2004-05-19 Thread Ford, Mike [LSS]
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] 
> Sent: 19 May 2004 15:47
> 
> If I'm being Dumb, I apologies...
> but When using this:
> 
> $row[bands] = "1,2,3,4,5,6,7,8";
> $row2[id] = "7";
> if (strpos($row[bands], $row2[id]) != FALSE) {
> // do stuff
> }
> 
> I get the No 13 (as it's inthe 13th place in the string) as my result.
> 
> Now I'm aware that it should work, as it's not returning a 
> false value... But I'm still not getting the correct output 
> on my page...

(i) needs to be !== not != (since the substring might appear in position 0 and 
0==FALSE).

(ii) post some lines of your actual code showing what you expect, and what you 
actually get.

(iii) to know exactly what we're dealing with, var_dump $row and $row2 before you do 
the strpos, and cut'n'paste the results for us.

(iv) also, quote your string subscripts ($row['bands']) -- not vital, but suppresses a 
constant-lookup and notice for each one, and hence is more efficient.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services, JG125, James Graham 
Building, Leeds Metropolitan University, Headingley Campus, LEEDS,  LS6 3QS,  United 
Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



RE: [PHP] IF statement question...

2004-05-19 Thread Michael Sims
Jay Blanchard wrote:
> [snip]
> strpos() : 0.18918436765671
> preg_match() : 0.26665662288666
> [/snip]
>
> 1/3rd of a second slowerinteresting. You know what though, my
> original assertion is correctalmost any of the regex functions
> will work.

Personally, I prefer using preg_match() 9 times out of 10 vs. strpos(), strstr(),
etc.  Whatever performance penalty I pay for doing this is a statistical drop in the
bucket compared to the overhead of, say, opening a connection to a database (which
nearly all of my pages do).  I'm also a perl guy so regex's are more natural to me
to read and write so I tend to favor them...

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



Re: [PHP] IF statement question...

2004-05-19 Thread John Nichel
Jay Blanchard wrote:
[snip]
strpos() : 0.18918436765671
preg_match() : 0.26665662288666
[/snip]
1/3rd of a second slowerinteresting. You know what though, my
original assertion is correctalmost any of the regex functions will
work.
Tristan, why not convert the string to an array and then use in_array()?
John, can you add the array speed test to your script? I'd like to know
how that stacks up too.
Okay, below is the new script...test will take a few to run.  I'm doing 
the explode of the haystack outside of the test, so it's only going to 
test the speed of in_array(), and not take into account how long it 
would take to create the array from a string.  I'll post the result in a 
few.

ini_set ( "max_execution_time", "72000" );
function getmicrotime() {
   list ( $usec, $sec ) = explode( " ", microtime() );
   return ( (float)$usec + (float)$sec );
}
$haystack= "Bob is good.";
$needle = "is";
$regex = "/is/";
$array = explode ( " ", $haystack );
$strpos_temp = 0;
$preg_match_temp = 0;
$in_array_temp = 0;
for ( $j = 0; $j < 1; $j++ ) {
	$t1 = getmicrotime();
	for ( $i = 0; $i < 10; $i++ ) {
		$pos = strpos ( $haystack, $needle );
	}
	$t2 = getmicrotime();
	for ( $i = 0; $i < 10; $i++ ) {
		preg_match ( $regex, $haystack );
	}
	$t3 = getmicrotime();
	for ( $i = 0; $i < 10; $i++ ) {
		in_array ( $needle, $array );
	}
	$t4 = getmicrotime();
	$strpos_temp += $t2 - $t1;
	$preg_match_temp += $t3 - $t2;
	$in_array_temp += $t4 - $t3;
}
$strpos = $strpos_temp / $j;
$preg_match = $preg_match_temp / $j;
$in_array = $in_array_temp / $j;
echo ( "strpos() : " . $strpos . "\npreg_match() : " . $preg_match 
. "\nin_array() : " . $in_array );

--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Problem - Turckmmcache, Apache2 and SuSE 9.1

2004-05-19 Thread raditha dissanayake
Perhaps you might want to try an mmcache list.
Andrei Verovski (aka MacGuru) wrote:
Hi,
I have compiled and installed (precisely following instruction) turck-mmcache 
2.4.6 for Apache2-2.0.49-23/php4-4.3.4-43.3 on SuSE 9.1.

Unfortunately, I cannot start Apapche2 anymore, I am getting this error 
message:

/usr/sbin/httpd2-prefork: error while loading shared 
libraries: /usr/lib/php/extensions/mmcache.so: undefined symbol: 
php_session_register_module
[Tue May 18 22:11:01 2004] [notice] suEXEC mechanism enabled 
(wrapper: /usr/sbin/suexec2)
[Tue May 18 22:11:01 2004] [warn] Init: Session Cache is not configured [hint: 
SSLSessionCache]
[Tue May 18 22:11:01 2004] [notice] Digest: generating secret for digest 
authentication ...
[Tue May 18 22:11:01 2004] [notice] Digest: done
/usr/sbin/httpd2-prefork: error while loading shared 
libraries: /usr/lib/php/extensions/mmcache.so: undefined symbol: 
php_session_register_module

Anyone have an idea how to fix this?
Thanks in advance
Andrei
-
Here is what I have added to php.ini at the bottom:
 extension="mmcache.so"
 mmcache.shm_size="16"
 mmcache.cache_dir="/tmp/mmcache"
 mmcache.enable="1"
 mmcache.optimizer="1"
 mmcache.check_mtime="1"
 mmcache.debug="0"
 mmcache.filter=""
 mmcache.shm_max="0"
 mmcache.shm_ttl="0"
 mmcache.shm_prune_period="0"
 mmcache.shm_only="0"
 mmcache.compress="1"
 


--
Raditha Dissanayake.
-
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] IMAP connect problem

2004-05-19 Thread raditha dissanayake
Hi,
Haseeb Iqbal wrote:
hi all,
when i try to connect to imap server i get this and the script aborts.
what should i do to fix.
Certificate failure for localhost: self signed certificate: /C=US/ST=NY/L=New York/O=Courier Mail Server/OU=Automatically-generated IMAP SSL key/CN=localhost/[EMAIL PROTECTED]
 

Guess you might want to start by reading up on IMAP ;-)
Looks to me like you are connecting using IMAPS (IMAP + TLS) instead of 
IMAP, it would also appear that the certificate you are using has 
expired. Try using plain old IMAP (on port 143). If you still have 
trouble please first try to login using mozilla to confirm that the 
server is indeed accepting connections.

Alternatively you can try to connect using good old telnet and try to 
execute imap commands.

Hope this helps.

consider myself a newbie in the world of linux.
 

There are IMAP servers for the M$ system as well :-)
Haseeb
 


--
Raditha Dissanayake.
-
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Problem - Turckmmcache, Apache2 and SuSE 9.1

2004-05-19 Thread Andrei Verovski (aka MacGuru)
Hi,

I have compiled and installed (precisely following instruction) turck-mmcache 
2.4.6 for Apache2-2.0.49-23/php4-4.3.4-43.3 on SuSE 9.1.

Unfortunately, I cannot start Apapche2 anymore, I am getting this error 
message:

/usr/sbin/httpd2-prefork: error while loading shared 
libraries: /usr/lib/php/extensions/mmcache.so: undefined symbol: 
php_session_register_module
[Tue May 18 22:11:01 2004] [notice] suEXEC mechanism enabled 
(wrapper: /usr/sbin/suexec2)
[Tue May 18 22:11:01 2004] [warn] Init: Session Cache is not configured [hint: 
SSLSessionCache]
[Tue May 18 22:11:01 2004] [notice] Digest: generating secret for digest 
authentication ...
[Tue May 18 22:11:01 2004] [notice] Digest: done
/usr/sbin/httpd2-prefork: error while loading shared 
libraries: /usr/lib/php/extensions/mmcache.so: undefined symbol: 
php_session_register_module

Anyone have an idea how to fix this?

Thanks in advance

Andrei

-

Here is what I have added to php.ini at the bottom:

  extension="mmcache.so"
  mmcache.shm_size="16"
  mmcache.cache_dir="/tmp/mmcache"
  mmcache.enable="1"
  mmcache.optimizer="1"
  mmcache.check_mtime="1"
  mmcache.debug="0"
  mmcache.filter=""
  mmcache.shm_max="0"
  mmcache.shm_ttl="0"
  mmcache.shm_prune_period="0"
  mmcache.shm_only="0"
  mmcache.compress="1"

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



Re: [PHP] IF statement question...

2004-05-19 Thread John Nichel
John Nichel wrote:
Jay Blanchard wrote:
[snip]
strpos() : 0.18918436765671
preg_match() : 0.26665662288666
[/snip]
1/3rd of a second slowerinteresting. You know what though, my
original assertion is correctalmost any of the regex functions will
work.
Tristan, why not convert the string to an array and then use in_array()?
John, can you add the array speed test to your script? I'd like to know
how that stacks up too.
Okay, below is the new script...test will take a few to run.  I'm doing 
the explode of the haystack outside of the test, so it's only going to 
test the speed of in_array(), and not take into account how long it 
would take to create the array from a string.  I'll post the result in a 
few.
Results :
strpos() : 0.19018315076828
preg_match() : 0.26157474517822
in_array() : 0.26403407096863
--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] IF statement question...

2004-05-19 Thread Jay Blanchard
[snip]
strpos() : 0.19018315076828
preg_match() : 0.26157474517822
in_array() : 0.26403407096863
[/snip]

Very interesting...thanks! 

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



[PHP] Lista en Espanol?

2004-05-19 Thread Lucas Passalacqua
Hole, queria saber si alguien conoce alguna lista en espanol sobre PHP.
Gracias!

-Mensaje original-
De: raditha dissanayake [mailto:[EMAIL PROTECTED] 
Enviado el: miercoles, 19 de mayo de 2004 13:10
Para: Haseeb Iqbal
CC: [EMAIL PROTECTED]
Asunto: Re: [PHP] IMAP connect problem

Hi,

Haseeb Iqbal wrote:

>hi all,
>when i try to connect to imap server i get this and the script aborts.
>
>what should i do to fix.
>
>Certificate failure for localhost: self signed certificate:
/C=US/ST=NY/L=New York/O=Courier Mail Server/OU=Automatically-generated
IMAP SSL key/CN=localhost/[EMAIL PROTECTED]
>  
>
Guess you might want to start by reading up on IMAP ;-)

Looks to me like you are connecting using IMAPS (IMAP + TLS) instead of 
IMAP, it would also appear that the certificate you are using has 
expired. Try using plain old IMAP (on port 143). If you still have 
trouble please first try to login using mozilla to confirm that the 
server is indeed accepting connections.

Alternatively you can try to connect using good old telnet and try to 
execute imap commands.

Hope this helps.


>consider myself a newbie in the world of linux.
>  
>
There are IMAP servers for the M$ system as well :-)

>Haseeb
>  
>


-- 
Raditha Dissanayake.
-
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.

-- 
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] Lista en Espanol?

2004-05-19 Thread James Kaufman
On Wed, May 19, 2004 at 02:02:37PM -0300, Lucas Passalacqua wrote:
> Hole, queria saber si alguien conoce alguna lista en espanol sobre PHP.
> Gracias!
> 

Start with http:///www.php.net/mailing-lists.php and look for Spanish PHP
Mailing List.

-- 
Jim Kaufman
Linux Evangelist
public key 0x6D802619
http://www.linuxforbusiness.net

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



[PHP] Re: Date Function - Empty Value

2004-05-19 Thread Torsten Roehr
"Gabe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Environment:
> PHP 4.3.6
> Access DB
> W2K IIS 5
>
>
> I'm trying to store a date in a date/time field using the short date
> format ( m/d/ ).  For some reason it won't let me post an empty
> value to that field in the DB.  I've tried using empty quotes ( "" ) or
> NULL and I always get a datatype mismatch sql error.  So then I just
> tried submitting a date that will never be used ( e.g. 1/1/ ).  That
> works, but then when I try to read the date out of the field in the DB
> and format it using the date() function in PHP it doesn't display
> anything (which is fine with me).  I read up on the date function on the
> PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on
> windows machines.  So that explains why the function returns nothing.
>
> So, I guess my question is this:  Is what I'm doing technically ok
> (using a date that's not in the valid range)?  Or does anyone know of an
> empty date value that I can submit to the DB?
>
> Thanks!

NULL should work if you have allowed it for the column when creating the
table. Can you post your table structure?

Regards, Torsten

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



Re: [PHP] IMAP connect problem

2004-05-19 Thread Haseeb Iqbal
i am using standard port 143.
- Original Message - 
From: "raditha dissanayake" <[EMAIL PROTECTED]>
To: "Haseeb Iqbal" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, May 19, 2004 9:10 PM
Subject: Re: [PHP] IMAP connect problem


> Hi,
>
> Haseeb Iqbal wrote:
>
> >hi all,
> >when i try to connect to imap server i get this and the script aborts.
> >
> >what should i do to fix.
> >
> >Certificate failure for localhost: self signed certificate:
/C=US/ST=NY/L=New York/O=Courier Mail Server/OU=Automatically-generated IMAP
SSL key/CN=localhost/[EMAIL PROTECTED]
> >
> >
> Guess you might want to start by reading up on IMAP ;-)
>
> Looks to me like you are connecting using IMAPS (IMAP + TLS) instead of
> IMAP, it would also appear that the certificate you are using has
> expired. Try using plain old IMAP (on port 143). If you still have
> trouble please first try to login using mozilla to confirm that the
> server is indeed accepting connections.
>
> Alternatively you can try to connect using good old telnet and try to
> execute imap commands.
>
> Hope this helps.
>
>
> >consider myself a newbie in the world of linux.
> >
> >
> There are IMAP servers for the M$ system as well :-)
>
> >Haseeb
> >
> >
>
>
> -- 
> Raditha Dissanayake.
> -
> http://www.raditha.com/megaupload/upload.php
> Sneak past the PHP file upload limits.
>
> -- 
> 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] Re: Date Function - Empty Value

2004-05-19 Thread Gabe
Torsten Roehr wrote:
"Gabe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Environment:
PHP 4.3.6
Access DB
W2K IIS 5
I'm trying to store a date in a date/time field using the short date
format ( m/d/ ).  For some reason it won't let me post an empty
value to that field in the DB.  I've tried using empty quotes ( "" ) or
NULL and I always get a datatype mismatch sql error.  So then I just
tried submitting a date that will never be used ( e.g. 1/1/ ).  That
works, but then when I try to read the date out of the field in the DB
and format it using the date() function in PHP it doesn't display
anything (which is fine with me).  I read up on the date function on the
PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on
windows machines.  So that explains why the function returns nothing.
So, I guess my question is this:  Is what I'm doing technically ok
(using a date that's not in the valid range)?  Or does anyone know of an
empty date value that I can submit to the DB?
Thanks!

NULL should work if you have allowed it for the column when creating the
table. Can you post your table structure?
Regards, Torsten
Well, I would, but I can't seem to figure out how to export just the 
structure out of access.  Wouldn't NULL be allowed by default?

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


[PHP] Re: Date Function - Empty Value

2004-05-19 Thread Matt Matijevich
[snip]
Well, I would, but I can't seem to figure out how to export just the 
structure out of access.  Wouldn't NULL be allowed by default?
[/snip]

Do you have access to the mdb file?  If you do you can just go into
design view of the table to find out the data definitions.

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



Re: [PHP] Re: Date Function - Empty Value

2004-05-19 Thread Gabe
Matt Matijevich wrote:
[snip]
Well, I would, but I can't seem to figure out how to export just the 
structure out of access.  Wouldn't NULL be allowed by default?
[/snip]

Do you have access to the mdb file?  If you do you can just go into
design view of the table to find out the data definitions.
I do have access to the mdb but there's no way for me to export the 
structure that I'm looking at so I can send it to other people.  Or do 
you know of a way?

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


[PHP] Re: Date Function - Empty Value

2004-05-19 Thread Torsten Roehr
"Gabe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Torsten Roehr wrote:
>
> > "Gabe" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>Torsten Roehr wrote:
> >>
> >>
> >>>"Gabe" <[EMAIL PROTECTED]> wrote in message
> >>>news:[EMAIL PROTECTED]
> >>>
> >>>
> Environment:
> PHP 4.3.6
> Access DB
> W2K IIS 5
> 
> 
> I'm trying to store a date in a date/time field using the short date
> format ( m/d/ ).  For some reason it won't let me post an empty
> value to that field in the DB.  I've tried using empty quotes ( "" )
or
> NULL and I always get a datatype mismatch sql error.  So then I just
> tried submitting a date that will never be used ( e.g. 1/1/ ).
That
> works, but then when I try to read the date out of the field in the DB
> and format it using the date() function in PHP it doesn't display
> anything (which is fine with me).  I read up on the date function on
the
> PHP website and valid dates are limited from 01-01-1970 to 19-01-2038
on
> windows machines.  So that explains why the function returns nothing.
> 
> So, I guess my question is this:  Is what I'm doing technically ok
> (using a date that's not in the valid range)?  Or does anyone know of
an
> empty date value that I can submit to the DB?
> 
> Thanks!
> >>>
> >>>
> >>>NULL should work if you have allowed it for the column when creating
the
> >>>table. Can you post your table structure?
> >>>
> >>>Regards, Torsten
> >>
> >>Well, I would, but I can't seem to figure out how to export just the
> >>structure out of access.  Wouldn't NULL be allowed by default?
> >
> >
> > This command should show you the table structure:
> > SHOW CREATE TABLE tablename
> >
> > Please post the output.
> >
> > regards, Torsten
>
>
> Sorry Torsten, but you'll have to forgive my lack of understanding.
> Where should I put that command in?
>
> Thanks for you patience.

In the mysql command line, if possible or if you're using phpMyAdmin. Should
also work with mysql_query() in a php script and echoing out the result. Do
you know how to do this?

Regards, Torsten

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



[PHP] Re: How to use pcntl_fork()?

2004-05-19 Thread Ben Ramsey
Does no one know how to use pcntl_fork(), then?
;-)
Ben Ramsey wrote:
I'm working with PHP-GTK to create a GUI application.  This GUI 
application opens a socket to a "gaming" server to send/receive data to 
display to the user.  So far, this is working well, but the problem is 
that it can only receive data after I make a function call to send data.

Here's my program logic so far:
I have the following functions:
enter_key()
send()
receive()
output()
When the user enters text into the text input field, they click their 
"Enter" key.  This calls the enter_key() function.  When this function 
is called, it gets the text from the input field and passes it along to 
send(), which sends it to the socket.  Then enter_key() calls receive(), 
which receives data from the socket.  The receive() function calls the 
output() function, which displays the received data to the user in a GTK 
widget.

So far, the program can only receive data from the socket when a call 
has been made to receive(), and I am explicitly calling receive() after 
the user clicks the Enter key.  This means that data the game is 
transmitting is not being received until the user enters something.

This is not preferable.  What I would like to do is to have a sort of 
"listener" that listens on the socket and contantly receives data.  It 
has been suggested that I use pcntl_fork() to do this, but I have looked 
at the manual and user-contributed notes for this, and I can't quite 
grasp how it's supposed to look in my code.

So far, I've done something along these lines at the very end of my script:
$pid = pcntl_fork();
if ($pid == -1)
{
die("could not fork");
}
elseif ($pid)
{
exit(0);
}
else
{
while (1)
{
receive();
}
}
I'm not sure this is working, though.  It does not seem to be receiving 
from the socket unless I send.  Ultimately, I want to remove all calls 
to receive() from my main program and let the "listener" take control of 
that, but I can't even tell if the above code is working, or if I'm even 
grasping how to make it work.

Any help or pointers is greatly appreciated.
--
Regards,
 Ben Ramsey
 http://benramsey.com
---
http://www.phpcommunity.org/
Open Source, Open Community
Visit for more information or to join the movement.
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Text/Image Streaming in PHP for a web chat application

2004-05-19 Thread Vail, Warren
I had a problem that I think might be similar to what you are struggling
with and solved it by causing the browser to drive the "push" (or in this
case more like a "pull").  The main page was sent with an imbedded frame and
other controls to allow the user to type in his real-time responses and a
submit button to send them.  If I recall the details correctly, what
appeared in the imbedded frame was a separate page that contained JavaScript
that that caused the imbedded page to be automatically refreshed every few
seconds (this would display your chat activity query results, refreshing
every few seconds), while the textarea on the base page remained static for
a user to type in and submit their own text.  It worked in the version of IE
I was supporting, but is at best risky that odd browsers (or other browsers)
won't support IFRAMEs in exactly the same way.

This worked for me, hope it gives you an option, other than resorting to an
applet, yeuk. ;-)

Warren Vail


-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 19, 2004 2:00 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Text/Image Streaming in PHP for a web chat application


Stephen Lake wrote:
> Hey all,
> 
> After reviewing all the scripts written for a web chat application at 
> the various sites (ie Hotscripts, cgi resource and so on) I have 
> resorted to writing my own as none available fit my specific 
> requirements.
> 
> What I need to know is, how can I implement a server push alternative 
> and/or text stream to a browser? or for that matter if anyone has code 
> available or knows of code that is even remotely similar to IFCS 
> (Interfun Chat Server
> http://www.interfun.com) they would be willing to share with me would be
> greatly appreciated.
> 

I've played around with this a couple of times.  Once using sockets, and 
another time just setting the max_execution_time of the script in the 
bottom frame to some ungodly size, running a loop which checks for new 
messages after sleeping for 10 seconds or so.  It turned out to be more 
of a pain than it was going to be worth.  If you come across something 
that has the look and feel of Chatropolis, but doesn't cost $1500, I'm 
interested.

BTW, it's http://www.interfun.net

-- 
John C. Nichel
KegWorks.com
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] Text/Image Streaming in PHP for a web chat application

2004-05-19 Thread Stephen Lake
Hey all,

After reviewing all the scripts written for a web chat application at the
various sites (ie Hotscripts, cgi resource and so on) I have resorted to
writing my own as none available fit my specific requirements.

What I need to know is, how can I implement a server push alternative and/or
text stream to a browser? or for that matter if anyone has code available or
knows of code that is even remotely similar to IFCS (Interfun Chat Server
http://www.interfun.com) they would be willing to share with me would be
greatly appreciated.

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



Re: [PHP] Text/Image Streaming in PHP for a web chat application

2004-05-19 Thread John Nichel
Stephen Lake wrote:
Hey all,
After reviewing all the scripts written for a web chat application at the
various sites (ie Hotscripts, cgi resource and so on) I have resorted to
writing my own as none available fit my specific requirements.
What I need to know is, how can I implement a server push alternative and/or
text stream to a browser? or for that matter if anyone has code available or
knows of code that is even remotely similar to IFCS (Interfun Chat Server
http://www.interfun.com) they would be willing to share with me would be
greatly appreciated.
I've played around with this a couple of times.  Once using sockets, and 
another time just setting the max_execution_time of the script in the 
bottom frame to some ungodly size, running a loop which checks for new 
messages after sleeping for 10 seconds or so.  It turned out to be more 
of a pain than it was going to be worth.  If you come across something 
that has the look and feel of Chatropolis, but doesn't cost $1500, I'm 
interested.

BTW, it's http://www.interfun.net
--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Date Function - Empty Value

2004-05-19 Thread Gabe
Torsten Roehr wrote:
"Gabe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Torsten Roehr wrote:

"Gabe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

Environment:
PHP 4.3.6
Access DB
W2K IIS 5
I'm trying to store a date in a date/time field using the short date
format ( m/d/ ).  For some reason it won't let me post an empty
value to that field in the DB.  I've tried using empty quotes ( "" ) or
NULL and I always get a datatype mismatch sql error.  So then I just
tried submitting a date that will never be used ( e.g. 1/1/ ).  That
works, but then when I try to read the date out of the field in the DB
and format it using the date() function in PHP it doesn't display
anything (which is fine with me).  I read up on the date function on the
PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on
windows machines.  So that explains why the function returns nothing.
So, I guess my question is this:  Is what I'm doing technically ok
(using a date that's not in the valid range)?  Or does anyone know of an
empty date value that I can submit to the DB?
Thanks!

NULL should work if you have allowed it for the column when creating the
table. Can you post your table structure?
Regards, Torsten
Well, I would, but I can't seem to figure out how to export just the
structure out of access.  Wouldn't NULL be allowed by default?

This command should show you the table structure:
SHOW CREATE TABLE tablename
Please post the output.
regards, Torsten

Sorry Torsten, but you'll have to forgive my lack of understanding. 
Where should I put that command in?

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


[PHP] Re: Date Function - Empty Value

2004-05-19 Thread Torsten Roehr
"Gabe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Torsten Roehr wrote:
>
> > "Gabe" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>Environment:
> >>PHP 4.3.6
> >>Access DB
> >>W2K IIS 5
> >>
> >>
> >>I'm trying to store a date in a date/time field using the short date
> >>format ( m/d/ ).  For some reason it won't let me post an empty
> >>value to that field in the DB.  I've tried using empty quotes ( "" ) or
> >>NULL and I always get a datatype mismatch sql error.  So then I just
> >>tried submitting a date that will never be used ( e.g. 1/1/ ).  That
> >>works, but then when I try to read the date out of the field in the DB
> >>and format it using the date() function in PHP it doesn't display
> >>anything (which is fine with me).  I read up on the date function on the
> >>PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on
> >>windows machines.  So that explains why the function returns nothing.
> >>
> >>So, I guess my question is this:  Is what I'm doing technically ok
> >>(using a date that's not in the valid range)?  Or does anyone know of an
> >>empty date value that I can submit to the DB?
> >>
> >>Thanks!
> >
> >
> > NULL should work if you have allowed it for the column when creating the
> > table. Can you post your table structure?
> >
> > Regards, Torsten
>
> Well, I would, but I can't seem to figure out how to export just the
> structure out of access.  Wouldn't NULL be allowed by default?

This command should show you the table structure:
SHOW CREATE TABLE tablename

Please post the output.

regards, Torsten

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



Re: [PHP] IF statement question...

2004-05-19 Thread Curt Zirzow
* Thus wrote Jay Blanchard ([EMAIL PROTECTED]):
> [snip]
> strpos() : 0.19018315076828
> preg_match() : 0.26157474517822
> in_array() : 0.26403407096863
> [/snip]
> 
> Very interesting...thanks! 
> 
So if we're not going to search though a string 10,000 times you'll
save ~0.07139159440994 seconds.  or am I missing something?


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



[PHP] Re: Distance and info

2004-05-19 Thread Manuel Lemos
Hello,
On 05/19/2004 09:51 AM, Brent Clark wrote:
I have a question regarding phpclasses.org.
There is a section, where is says, "Find the closest mirror".
My question is, does anyone know how do they determine the distance (Sits on
the right of the screen) and also
the details for "Your approximate location".
Cause its pretty acurrate.
Currently the site uses this class to locate the user network by the IP. 
It is not always very accurate but it works most of the time:

http://www.phpclasses.org/netgeoclass
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Constant questions

2004-05-19 Thread Don Read

On 12-May-2004 René Fournier wrote:
> Hi,
> 
> I have two questions involving Constants.
> 
> 1. I want to refer to a refer to a Constant by its value (which is 
> unique), and return its name. E.g.,:
> 
>   define ("SEND_DS","1");
>   define ("SEND_DS_ACK","2");
>   define ("RESEND_DS","3");
>   define ("STARTUP_DS","12");
> 
> For example, if I receive "3", I would like to echo "RESEND_DS"--the 
> name of the constant. Is there a simply way to do this? Or am I
> better 
> using an Associative Array (which is what I was thinking)? Then I
> could 
> such refer to an element by its key or value (both of which are 
> unique). 

Both.

get_defined_constants()
array_flip()

Regards,

-- 
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

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



Re: [PHP] Best way to do "Last 3 Items Viewed"

2004-05-19 Thread Don Read

On 14-May-2004 Chuck Barnett wrote:
> Anyone have any code snippits that would allow me to do a "Last 3
> Items
> Viewed" like on ebay?
> 

array_unshift($items, $new);
$items = array_slice($items, 0, 3));

Regards,

-- 
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

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



Re: [PHP] create if table not exists

2004-05-19 Thread Don Read

On 17-May-2004 John Taylor-Johnston wrote:
> How can I check if a table exists in a mysql db.

function tableexists($tbl) {
$res = @mysql_query("SELECT COUNT(*) FROM $tbl");
return ($res ? true : false);
}

Regards,

-- 
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

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



Re: [PHP] Multiple Update from one form

2004-05-19 Thread Don Read

On 18-May-2004 Miles Thompson wrote:
> 
> This is close to your situation, but I only needed a one dimensional
> array 
> for a bulk delete. So the form part has this line:
>  print( '');
> There's no need for a subscript in the form - there are presently a 
> potential of 963 elements in this array. When we check for bulk
> delete it's 
> never contiguous, we skip down the list, so array is v. sparse.
> 
> And the processing part uses this loop:
> 
>  foreach ($chkdelete as $value){
>  $sql = "delete from subscriber where sub_key =
> '$value'";
>  $result = mysql_query($sql);
>  }
> 
> This way I'm in no danger of hitting a missing subscript as I might
> if I 
> used $chkdelete[ $i ], incrementing $i
> 

Since it's a checkbox and you'll only get "checked" values in the 
$_POST header; you just might as well use the subscript and skip the
loop entirely:
...

if (count($_POST['chkdelete'])) {
$lst = implode("','",array_keys($_POST['chkdelete']));
$qry = "DELETE FROM subscriber WHERE sub_key IN ('$lst')";
mysql_query($qry);
}

...

Regards,

-- 
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

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