RE: [PHP] foreach statement

2002-01-09 Thread Niklas Lampén

Foreach works in PHP just like I told.

foreach($emails as $this_is_one_address) is the correct form where
$emails is an array and $this_is_one_address gets one element from
$emails.

This is similar to this (technically):

for ($i = 0; $i  count($emails); ++$i)
{
$this_is_one_address = $emails[$i];
// Do anything you want with $this_is_one_address
};

I suggest that you use the for-loop if $emails array is big. Takes less
memory.


Niklas



-Original Message-
From: Chris Grigor [mailto:[EMAIL PROTECTED]] 
Sent: 9. tammikuuta 2002 9:44
To: '[EMAIL PROTECTED]'; Php-General
Subject: RE: [PHP] foreach statement 


Hey Niklas

yea thats what I want, just one thing 

foreach($emails as $this_is_one_address) {

would it be 

foreach($emails) {   

or am I missing something in there ?

?





?
$sms_list = test_number; // This is the file with one e-mail address
per line? $emails = file($sms_list);

foreach($emails as $this_is_one_address) {
// Do what ever you want to.
// $this_is_one_address contains one element from $emails
};


Niklas



-Original Message-
From: Chris Grigor [mailto:[EMAIL PROTECTED]] 
Sent: 9. tammikuuta 2002 8:59
To: 'Php-General-List (E-mail)'
Subject: [PHP] foreach statement 


Okay lets see who has there thinking caps on today (cos I really dont)

I have a list of email addresses stored in a text file.

I am able to run the script and get all the mail addresses in the list
mailed but 
thats all in one mail. I want to be able to open the file, chop each
line and send 
individual messages to each address.. okay who is confused as Im not
giving you much 
description here, well okay heres what the script looks like

#!/usr/bin/php -q

?


$sms_list = test_number;
$emails = file($sms_list);

for ($i=0; $i  count($emails); $i++) $emails[$i] =
trim($emails[$i]);
$recipient = implode(,, $emails);

print $recipient;


{

$mail_subject=test this;
$mail_body=testing;
mail($recipient, $mail_subject, $mail_body);
print mail sent\n;

}


?


Im just thinking(trying to at least) I need some sort of foreach
statement like in perl, right? 
so that it would say 

foreach($recipient)
{ 
send mail 
}


anyone that could maybe guide me? 

Thanks in advance

C-Ya

Chris Grigor


--
Client Services
Call Center: 0860 100 154
Fax: +27 11 340 7345
E-Mail: [EMAIL PROTECTED]


--
M-WEB Business Solutions
Making it happen.

Go shopping @ http://shopping.mweb.co.za 
Get your business online @ http://business.mweb.com 

We all know Linux is great...it does infinite loops in 5 seconds.
- Linus Torvalds

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Fwd: curl questionnaire!

2002-01-09 Thread Sterling Hughes

For those of you who use the cURL extension, the underlying library
is putting up a little questionaire, to help get a better idea of
what the cURL user community wants, feel free to go ahead and
participate, the URL (without reading the attachment :) is:

http://curl.haxx.se/q/

-Sterling


---BeginMessage---

Hello fellow curl users!

I'd like to ask you all who read this to skip over to the curl web site and
fill in the questionnaire regarding various aspects of curl.

I want to know what we all think of curl, what the general people think is
important, what's bad, what's good and where to put the most focus in the
immediate future development.

There are ten quickly answered questions that'll only take you a few minutes
to fill in.

Give me your view of things on this URL:

http://curl.haxx.se/q/

I appreciate if you fill in your opinion only once for each individual.

-- 
Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/






---End Message---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


RE: [PHP] foreach statement

2002-01-09 Thread Chris Grigor

Thanks!! its working !!! 

***BIG SMILE

Niklas you genious 



-Original Message-
From: Niklas Lampén [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 09, 2002 10:15 AM
To: Php-General
Subject: RE: [PHP] foreach statement 


Foreach works in PHP just like I told.

foreach($emails as $this_is_one_address) is the correct form where
$emails is an array and $this_is_one_address gets one element from
$emails.

This is similar to this (technically):

for ($i = 0; $i  count($emails); ++$i)
{
$this_is_one_address = $emails[$i];
// Do anything you want with $this_is_one_address
};

I suggest that you use the for-loop if $emails array is big. Takes less
memory.


Niklas



-Original Message-
From: Chris Grigor [mailto:[EMAIL PROTECTED]] 
Sent: 9. tammikuuta 2002 9:44
To: '[EMAIL PROTECTED]'; Php-General
Subject: RE: [PHP] foreach statement 


Hey Niklas

yea thats what I want, just one thing 

foreach($emails as $this_is_one_address) {

would it be 

foreach($emails) {   

or am I missing something in there ?

?





?
$sms_list = test_number; // This is the file with one e-mail address
per line? $emails = file($sms_list);

foreach($emails as $this_is_one_address) {
// Do what ever you want to.
// $this_is_one_address contains one element from $emails
};


Niklas



-Original Message-
From: Chris Grigor [mailto:[EMAIL PROTECTED]] 
Sent: 9. tammikuuta 2002 8:59
To: 'Php-General-List (E-mail)'
Subject: [PHP] foreach statement 


Okay lets see who has there thinking caps on today (cos I really dont)

I have a list of email addresses stored in a text file.

I am able to run the script and get all the mail addresses in the list
mailed but 
thats all in one mail. I want to be able to open the file, chop each
line and send 
individual messages to each address.. okay who is confused as Im not
giving you much 
description here, well okay heres what the script looks like

#!/usr/bin/php -q

?


$sms_list = test_number;
$emails = file($sms_list);

for ($i=0; $i  count($emails); $i++) $emails[$i] =
trim($emails[$i]);
$recipient = implode(,, $emails);

print $recipient;


{

$mail_subject=test this;
$mail_body=testing;
mail($recipient, $mail_subject, $mail_body);
print mail sent\n;

}


?


Im just thinking(trying to at least) I need some sort of foreach
statement like in perl, right? 
so that it would say 

foreach($recipient)
{ 
send mail 
}


anyone that could maybe guide me? 

Thanks in advance

C-Ya

Chris Grigor


--
Client Services
Call Center: 0860 100 154
Fax: +27 11 340 7345
E-Mail: [EMAIL PROTECTED]


--
M-WEB Business Solutions
Making it happen.

Go shopping @ http://shopping.mweb.co.za 
Get your business online @ http://business.mweb.com 

We all know Linux is great...it does infinite loops in 5 seconds.
- Linus Torvalds

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] foreach statement

2002-01-09 Thread Niklas Lampén

You're welcome. :)


Niklas


P.S. I know... ;)


-Original Message-
From: Chris Grigor [mailto:[EMAIL PROTECTED]] 
Sent: 9. tammikuuta 2002 10:23
To: '[EMAIL PROTECTED]'; Php-General
Subject: RE: [PHP] foreach statement 


Thanks!! its working !!! 

***BIG SMILE

Niklas you genious 



-Original Message-
From: Niklas Lampén [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 09, 2002 10:15 AM
To: Php-General
Subject: RE: [PHP] foreach statement 


Foreach works in PHP just like I told.

foreach($emails as $this_is_one_address) is the correct form where
$emails is an array and $this_is_one_address gets one element from
$emails.

This is similar to this (technically):

for ($i = 0; $i  count($emails); ++$i)
{
$this_is_one_address = $emails[$i];
// Do anything you want with $this_is_one_address
};

I suggest that you use the for-loop if $emails array is big. Takes less
memory.


Niklas



-Original Message-
From: Chris Grigor [mailto:[EMAIL PROTECTED]] 
Sent: 9. tammikuuta 2002 9:44
To: '[EMAIL PROTECTED]'; Php-General
Subject: RE: [PHP] foreach statement 


Hey Niklas

yea thats what I want, just one thing 

foreach($emails as $this_is_one_address) {

would it be 

foreach($emails) {   

or am I missing something in there ?

?





?
$sms_list = test_number; // This is the file with one e-mail address
per line? $emails = file($sms_list);

foreach($emails as $this_is_one_address) {
// Do what ever you want to.
// $this_is_one_address contains one element from $emails
};


Niklas



-Original Message-
From: Chris Grigor [mailto:[EMAIL PROTECTED]] 
Sent: 9. tammikuuta 2002 8:59
To: 'Php-General-List (E-mail)'
Subject: [PHP] foreach statement 


Okay lets see who has there thinking caps on today (cos I really dont)

I have a list of email addresses stored in a text file.

I am able to run the script and get all the mail addresses in the list
mailed but 
thats all in one mail. I want to be able to open the file, chop each
line and send 
individual messages to each address.. okay who is confused as Im not
giving you much 
description here, well okay heres what the script looks like

#!/usr/bin/php -q

?


$sms_list = test_number;
$emails = file($sms_list);

for ($i=0; $i  count($emails); $i++) $emails[$i] =
trim($emails[$i]);
$recipient = implode(,, $emails);

print $recipient;


{

$mail_subject=test this;
$mail_body=testing;
mail($recipient, $mail_subject, $mail_body);
print mail sent\n;

}


?


Im just thinking(trying to at least) I need some sort of foreach
statement like in perl, right? 
so that it would say 

foreach($recipient)
{ 
send mail 
}


anyone that could maybe guide me? 

Thanks in advance

C-Ya

Chris Grigor


--
Client Services
Call Center: 0860 100 154
Fax: +27 11 340 7345
E-Mail: [EMAIL PROTECTED]


--
M-WEB Business Solutions
Making it happen.

Go shopping @ http://shopping.mweb.co.za 
Get your business online @ http://business.mweb.com 

We all know Linux is great...it does infinite loops in 5 seconds.
- Linus Torvalds

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] binary data - MSSQL

2002-01-09 Thread Peter Lavender

Hi Everyone,

I did ask this earlier, but I have made some head way since, but I'm still
not sure that I have things right.

What datatype should I use for zip files?

How do I create a link to a file to be downloaded from the database?

All the examples I have read all relate to images, which hasn't really
helped.

THanks,

Pete


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] IP address from which country

2002-01-09 Thread Jon Farmer

No such table, the best you can do is look at their hostname and parse the
last part ie .co.uk or .com... And then u can try and figure where they are
from that

Err... Wrong.

You could host a .co.uk in the US or any other country for that matter! What
you need to do is find the IP do a RIPE lookup at www.ripe.net and that will
tell you who the IP is assigned to and where in the world they are. Of
course if its a ISP in Maryland, USA they could have a dialup user from
Australia connected so it only gives limited information.

Regards

Jon

--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key








-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] IP address from which country

2002-01-09 Thread Dimitris Kossikidis

I 'm not sure, but i beleive you can get visitor's country from Apache 's
Varialble $HTTP_ACCEPT_LANGUAGE. For further information read Predefined
Variables in the manual.

Hope it works!!!




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP Security Extension

2002-01-09 Thread List Client

First of all sorry if you have already read this on one of the other PHP
Mailing Lists, the reason I am posting it in a couple of different ones is
because I really do believe that many people can make use of this extenstion
and I know there are people out there who need this extension because I have
read post about people who are having problem hiding SQL passwords in scripts
etc.

Anyway here's the message:

Hi,
Maybe one or two of you may have read a post a while back about a PHP security
extention called Scripthash. For those of you who can't remember or don't know
this extension it lets you solve the age old problem of hardcoding passwords in
your PHP scripts and also makes it possible to execute scripts from PHP as a
different user (or even root) safely! This extension can ONLY be used when you
are using PHP as an Apache module on a Unix/Linux platform.

The original version was hard to install as you would have to compile it into
PHP. It also had some major bugs, the new version 0.5 has all previously known
bugs fixed and some new features. Scripthash 0.5 is for PHP 4.1.x (only tested
with 4.1.1) but users of PHP 4.0.x can download Scripthash 0.4 which is exactly
the same but made to run with 4.0.x.

The new version is very easy to install, all you need to do is either download
the tarball or the RedHat Source RPM and build then install. Then add the
following lines to you php.ini

 extension_dir=/usr/lib/php/extensions
 extension=scripthash.so

then restart Apache. To confirm everything it is working make a script with a
call to the phpinfo() function and there should now be a section called
Scripthash. To use the extenstion see README.html

To use some extended functionality you have to patch the PHP source code then
rebuild it. This patch will give you two new PHP globals called $VIRTUAL_UID
and $VIRTUAL_GID which contains the user id and the group id of the virtual
server being hit, you don't have to do this but you will get more control with
scripthash.

Finally I'll tell you what I hope to get from posting this message, I would
just like to see some interest, bug reports, suggestions, comments and maybe
some well written scripthash daemons (see README.html) :). I think this is an
extremely useful piece of code and it is now stable and easy to use.

You can get/find out more about Scripthash at
http://www.scl.co.uk/scripthash/ Sadly we have not had the time to update the
documentation for this module but it is on our TODO list and in the mean time
we are happy to reply to and emails you send us.

Thanks for your time
Tom

-- 

***
List Client
SCL Internet Services
URL http://www.scl.co.uk/
Tel. +44 (0) 1239 711 888
***

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: CC Processing in PHP

2002-01-09 Thread gurix

hea

http://www.phparchiv.de/cgi-bin/links/jump.cgi?ID=182
and
http://www.phparchiv.de/cgi-bin/links/jump.cgi?ID=2015

gurix

Muhammad Asif [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 hi,

 Do PHP has some built-in support for Credit Card Processing?

 Is there any library available that can be used for processing Credit
Cards?

 Thanks for your time.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: I am very new Question

2002-01-09 Thread gurix

hea

1. take a given javascriptmenu

2. develop a database with th menu items

3. make the Javascript dynamical  with the php variables.

It isn't anything to learn develop in php, just take it step for step.

gurix

Kevin P [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello

 I am extremely new to PHP and I want to have a clickable item that will
 bring up a particular item from the database (i.e a menu) What is the
 proceedure here? Can anyone help me?

 Thanks

 Kevin





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: bcc

2002-01-09 Thread php

// here's a nice example for a bcc adress, just generate a header

$headers .= From: Birthday Reminder [EMAIL PROTECTED]\r\n;

$headers .= Cc: [EMAIL PROTECTED]\r\n;
$headers .= Bcc: [EMAIL PROTECTED]\r\n;

/* and now mail it */
mail($to, $subject, $message, $headers);

gurix


Tim Ward [EMAIL PROTECTED] schrieb im Newsbeitrag
01D892A483EAD511926A00500416D3C004767A@HUNTERS-MAIL">news:01D892A483EAD511926A00500416D3C004767A@HUNTERS-MAIL...
 If you mean blind carbon copy on e-mails then
 www.php.net/manual/en/function.mail.php
 http://www.php.net/manual/en/function.mail.php  explains how to do it.
If
 you mean anything else please elaborate

 Tim
 www.chessish.com http://www.chessish.com

 --
 From:  Deependra B. Tandukar [SMTP:[EMAIL PROTECTED]]
 Sent:  07 January 2002 03:29
 To:  PHP General
 Subject:  bcc

 Greetings !

 Is Bcc supported in PHP?

 Looking forward to hearing from you.

 Warm Regards,
 DT




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] IP address from which country

2002-01-09 Thread Eugene Lee

On Wed, Jan 09, 2002 at 11:33:46AM +0200, Dimitris Kossikidis wrote:
: 
: I 'm not sure, but i beleive you can get visitor's country from Apache 's
: Varialble $HTTP_ACCEPT_LANGUAGE. For further information read Predefined
: Variables in the manual.

This works assuming the browser itself sends the correct country code.
Browsers in most places will send a Content-language: en regardless of
what country the user's browser is running within.


-- 
Eugene Lee
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] this is a test. Plz ignore.

2002-01-09 Thread fabrizio

...



[PHP] unshift a key value pair

2002-01-09 Thread Marc Logghe

Hi,
I was wondering how you could unshift a key value pair onto an array.
In the manual one suggested using a function like this:
function array_unshift_assoc($arr, $key, $val)
{
$arr = array_reverse($arr, true);
$arr[$key] = $val;
$arr = array_reverse($arr, true);
return count($arr);
}
it is a nice trick but this did not really convince me.
When you have eg an array like this: $a = array(foo=bar,
foo2=bar2) and you do an array_shift operation,
you end up with (foo2=bar2). So it is really easy to *remove* a
key-value
pair, but how do you put one in ?
Marc





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] unshift a key value pair

2002-01-09 Thread Andrey Hristov

Try array_merge() 


Regards,
Andrey Hristov
- Original Message - 
From: Marc Logghe [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 09, 2002 10:55 AM
Subject: [PHP] unshift a key value pair


 Hi,
 I was wondering how you could unshift a key value pair onto an array.
 In the manual one suggested using a function like this:
 function array_unshift_assoc($arr, $key, $val)
 {
 $arr = array_reverse($arr, true);
 $arr[$key] = $val;
 $arr = array_reverse($arr, true);
 return count($arr);
 }
 it is a nice trick but this did not really convince me.
 When you have eg an array like this: $a = array(foo=bar,
 foo2=bar2) and you do an array_shift operation,
 you end up with (foo2=bar2). So it is really easy to *remove* a
 key-value
 pair, but how do you put one in ?
 Marc
 
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP env variables... ?

2002-01-09 Thread fabrizio

Hi,
I'm trying to let Webmin execute a script where I can use php as scripting 
language... (It will be good to work with a language as php in a remote administration 
server, as root!)

Now the STRANGE problem:

When I execute a test.cgi program from Webmin, it's executed as root, as it was from 
command line... that's good. The problem is that Webmin execute well _every_ program I 
tried , EXCEPT php !

It seems that php needs some env variables to work well, and these variables aren't 
provided from the Webmin program, so to solve the problem I've to first understand WHY 
php does not work...

Here are some tests:

1) Executing a php that produce some output, or create a file works only when called 
from a login shell, not in Webmin
2) Executing a script that invoke at with the previous script doesn't work as 
well... from atq the scheduled processes are the same, but the one invoked from a 
login shell works, the invoked from Webmin not at all...

... what to do ?!?

thanx very much,
prakash




Re: [PHP] unshift a key value pair

2002-01-09 Thread Marc Logghe

That's exactly what I did to make it work I gave up playing with
array_unshift.
Thanks anyway.
Marc
Andrey Hristov [EMAIL PROTECTED] wrote in message
087501c198ff$45961270$0b01a8c0@ANDreY">news:087501c198ff$45961270$0b01a8c0@ANDreY...
 Try array_merge()


 Regards,
 Andrey Hristov
 - Original Message -
 From: Marc Logghe [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, January 09, 2002 10:55 AM
 Subject: [PHP] unshift a key value pair


  Hi,
  I was wondering how you could unshift a key value pair onto an array.
  In the manual one suggested using a function like this:
  function array_unshift_assoc($arr, $key, $val)
  {
  $arr = array_reverse($arr, true);
  $arr[$key] = $val;
  $arr = array_reverse($arr, true);
  return count($arr);
  }
  it is a nice trick but this did not really convince me.
  When you have eg an array like this: $a = array(foo=bar,
  foo2=bar2) and you do an array_shift operation,
  you end up with (foo2=bar2). So it is really easy to *remove* a
  key-value
  pair, but how do you put one in ?
  Marc
 
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] binary data - MSSQL

2002-01-09 Thread Henning Sprang

Hy Peter,

Peter Lavender wrote:

 Hi Everyone,
 
 I did ask this earlier, but I have made some head way since, but I'm still
 not sure that I have things right.
 
 What datatype should I use for zip files?


You should use the blob type therefore


 
 How do I create a link to a file to be downloaded from the database?


first you need a php script that pulls the data out of the database and 
echoes an appropriate header, and after this all the binary data of your 
file, you would then link it and give the id or whatever you use to 
identify it in the database as parameter to this script.


 
 All the examples I have read all relate to images, which hasn't really
 helped.


it's exactly the same with zips as with images, the only difference is 
the header for the mime type which is image/gif for gif's and
application/zip for zips
If you already know everything for images out oif a Mysql, then i don't 
tell it again here - ask if you still have problems!

henning






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: unshift a key value pair

2002-01-09 Thread CC Zona

In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Marc Logghe) wrote:

 So it is really easy to *remove* a key-value pair, but how do you put one in ?

$arr[$key]=$val;

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: unshift a key value pair

2002-01-09 Thread Marc Logghe

Yes, of course, but the thing is that the order was important. I wanted to
put in a new value/pair at the *start* of my array, so I thougth using
array_unshift(), but that did not work or at leas I did not find how.
With the $arr[$key]=$val assignment you add at the *end* of your array $arr.
Thanks for your fast response
Marc

Cc Zona [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 In article [EMAIL PROTECTED],
  [EMAIL PROTECTED] (Marc Logghe) wrote:

  So it is really easy to *remove* a key-value pair, but how do you put
one in ?

 $arr[$key]=$val;

 --
 CC



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] echo problem NEW

2002-01-09 Thread Henning Sprang

Hy,



universal2001 wrote:

 Hi again!
 
 Thanks for the reply!
 
 I still have another question:

 
 so I tired to use (echo) like this:
 
 echo table border=0 cellpadding=0 cellspacing=0 width=639
   tr
 tdimg src=img_heading/spacer.gif width=25 height=1
 border=0/td
   /tr
   tr
 td colspan=11img name=index_r1_c1
 src=img_heading/index_r1_c1.gif width=639 height=5 border=0/td
 tdimg src=img_heading/spacer.gif width=1 height=5
 border=0/td
   /tr
   tr
 td rowspan=5img name=index_r2_c1
 src=img_heading/index_r2_c1.gif width=25 height=43 border=0/td
 /table;
 but it DOES NOT WORK.
 How do I get way with all of the quotation marks




1) you can escape each double quote with a backslash,
the first line of your thing woulkd then look like

echo table border=\0\ cellpadding=\0\ cellspacing=\0\ width=\639\

and so on

2) if you don't want this by any reason, you can use single quotes to 
mark the text you want to print out like in

echo 'table width=100%';

the difference is that with single quotes you will _not_ be able to use 
variable replacement in between the quotes, something like

?
$myvar=100;
echo table width=\$myvar\;
?

will output

table width=100%


while this:

?
$myvar=100;
echo 'table width=$myvar';
?

will output exactly

table width=$myvar


hth,
henning



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] sessions, PHPSESSID, cookies

2002-01-09 Thread gkin

I have a website where I use sessions. After a user has logged of, the logon
screen appears again. The username field is filled with the value from a
cookie.

What happens:

For example: username = Peter

In the situation that I log of (and the logon page appears), the username
field gets the value from the cookie and the string ; PHPSESSID. (Peter;
PHPSESSID)

When I close the browser window and open a new browser window the value of
the username is correct (Peter). The string ; PHPSESSID is not in the
cookie. What is the reason that this string (the variable name for session
id as set in my php.ini) appears in this field?

In other words, why is the session_id variable name displayed in a field
that is filled by a cookie. I also tried to end the session, but the only
thing I can find is destroy_session and that only destroys everything that
is within that session, but it does not kill the session itsselfs

How do I solve this problem.

Regards,

Gilbert




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] binary data - MSSQL

2002-01-09 Thread Daniel Masur

are you shure about putting binarydata into a database?

cant you do it with links?
performance would be better this way i think.

Henning Sprang [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hy Peter,

 Peter Lavender wrote:

  Hi Everyone,
 
  I did ask this earlier, but I have made some head way since, but I'm
still
  not sure that I have things right.
 
  What datatype should I use for zip files?


 You should use the blob type therefore


 
  How do I create a link to a file to be downloaded from the database?


 first you need a php script that pulls the data out of the database and
 echoes an appropriate header, and after this all the binary data of your
 file, you would then link it and give the id or whatever you use to
 identify it in the database as parameter to this script.


 
  All the examples I have read all relate to images, which hasn't really
  helped.


 it's exactly the same with zips as with images, the only difference is
 the header for the mime type which is image/gif for gif's and
 application/zip for zips
 If you already know everything for images out oif a Mysql, then i don't
 tell it again here - ask if you still have problems!

 henning








-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] echo problem NEW

2002-01-09 Thread Nicolas Costes

Hellorghh !!!
You'd better do like this :

echo table border='0' cellpadding='0' cellspacing='0' width='639'


Le Mercredi 9 Janvier 2002 13:05, Henning Sprang a écrit :
 Hy,

 universal2001 wrote:
  Hi again!
 
  Thanks for the reply!
 
  I still have another question:
 
 
  so I tired to use (echo) like this:
 
  echo table border=0 cellpadding=0 cellspacing=0 width=639
tr
  tdimg src=img_heading/spacer.gif width=25 height=1
  border=0/td
/tr
tr
  td colspan=11img name=index_r1_c1
  src=img_heading/index_r1_c1.gif width=639 height=5 border=0/td
  tdimg src=img_heading/spacer.gif width=1 height=5
  border=0/td
/tr
tr
  td rowspan=5img name=index_r2_c1
  src=img_heading/index_r2_c1.gif width=25 height=43 border=0/td
  /table;
  but it DOES NOT WORK.
  How do I get way with all of the quotation marks

 1) you can escape each double quote with a backslash,
 the first line of your thing woulkd then look like

 echo table border=\0\ cellpadding=\0\ cellspacing=\0\
 width=\639\

 and so on

 2) if you don't want this by any reason, you can use single quotes to
 mark the text you want to print out like in

 echo 'table width=100%';

 the difference is that with single quotes you will _not_ be able to use
 variable replacement in between the quotes, something like

 ?
 $myvar=100;
 echo table width=\$myvar\;
 ?

 will output

 table width=100%


 while this:

 ?
 $myvar=100;
 echo 'table width=$myvar';
 ?

 will output exactly

 table width=$myvar


 hth,
 henning

-- 
 ( * Nicolas Costes,
 //\\  IUT de La Roche / Yon
( \/ ) [EMAIL PROTECTED]
http://luxregina.free.fr

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] echo problem NEW

2002-01-09 Thread Henning Sprang

Nicolas Costes wrote:

 Hellorghh !!!
 You'd better do like this :
 
 echo table border='0' cellpadding='0' cellspacing='0' width='639'

 

just another one - but i am too out of practice with html standarts to 
know if this is compliant ( a browser showing a result doesn't 
neccessary mean it's standarts compliant!)

henning





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] echo problem NEW

2002-01-09 Thread Nicolas Costes


Yes, you're right !!!

some browsers like IE will accept even  blah blah=0, blah blah='0', blah 
blah=0, and some like Opera will only understand :
IE SuxWithTooEasySyntax=1 ;-))

Le Mercredi 9 Janvier 2002 14:17, Henning Sprang a écrit :
 Nicolas Costes wrote:

-- 
 ( * Nicolas Costes,
 //\\  IUT de La Roche / Yon
( \/ ) [EMAIL PROTECTED]
http://luxregina.free.fr

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Problem input in flex scanner failed

2002-01-09 Thread Pavel Kharitonov

Hi,

Has anybody encountered the following error:

Fatal error: input in flex scanner failed in /***path***/info on line 1

The code that is most likely causing this is:

?php $my_cat_cust1=index.htm;
?
!-- Some HTML HERE --
?php if(file_exists(/***path***/info/$my_cat_cust1))
include(/***path***/info/$my_cat_cust1);
?

I'm running 4.0.6 on a Redhat 6.2

I'm completely stumped, this looks like a completely innocent code. Any help
or hits would be really appreciated!!

Sincerely,

Pavel Kharitonov
Project Manager
Intechnic Corporation
http://www.intechnic.com
Phone: (847) 816-1231



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] echo problem NEW

2002-01-09 Thread Bas van Rooijen


Hello,

In addition to Henning Sprang's fine solutions, you can also do the following (given 
you use PHP 4);


? $xmp_width = 5;
 $xmp_tdcolor = #FF;
 $xmp_text = Some text;

   echo EOF

TABLE WIDTH={$xmp_width}
TRTD COLOR={$xmp_tdcolor}$xmp_text/TD/TR
/TABLE

EOF;
   
?

Note that the {} around your variables are optional, they will not be included in the 
output but can be used to avoid confusion.

greets,

bvr.


On Wed, 9 Jan 2002 15:00:55 +0700, universal2001 wrote:

Hi again!

Thanks for the reply!

I still have another question:

I want to create a recycleable code by printing a set of html code which I
copied and paste from my html edittor.

however because there are lots of quotation marks on the html code it result
an error page.





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Including files variables ...

2002-01-09 Thread Bas van Rooijen


There's no need to 'pass' any variables.

HINT: pretend the include() command is being replaced with the code in your include 
file,
this means that whatever variables are set/available at that point will also be 
available in the include.

On Mon, 28 Jan 2002 18:54:02 -0800, Evansville Scene wrote:

I'm having problems passing variables into included PHP files.  How can I do this?





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Regex question

2002-01-09 Thread Jon Haworth

Hi all,

I've got a regex that's working fine, apart from one little problem. 

$tags = array (script,
   !--!\[CDATA\[,
   \]\]--);
foreach ($tags as $currentTag)
  if (preg_match (/^\/. $currentTag. /, $content)) 
// do something

(checking to see if anything in the $tags array is at the start of the
string)

The problem is that it's not picking up !--![CDATA[ and ]]--. I've
escaped the [ and ] as I know they're reserved in regexes, but it seems
there's something else that needs escaping or otherwise tweaking, and all
manner of experimentation has proved fruitless :-(

Can anyone help me out?

Cheers
Jon


Witan Jardine
13 Southampton Place
London WC1A 2AL
Tel: 020 7404 4004

Please visit us on the Internet:
http://www.witanjardine.co.uk/

The information included in this e-mail is of a confidential nature and is
intended only for the addressee.  If you are not the intended addressee, any
disclosure, copying or distribution by you is prohibited and may be
unlawful.  Disclosure to any party other than the addressee, whether
inadvertent or otherwise is not intended to waive privilege of
confidentiality.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Sessions don't load

2002-01-09 Thread Ryan Kelley

I have got a page that i am loading sessions on with the following code:

session_start();
$HTTP_SESSION_VARS['sess_id']=$PHPSESSID;

Except that it will not assign an actual value until i hit refresh on my
browser. Any ideas for a fix?

Thanks in advance,

Ryan Kelley



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP vs. ASP

2002-01-09 Thread Jake

Hello there, I need some help.

I have to do a technical report(about 2200 words) comparing PHP to ASP.  I
have already decided to make PHP the winner becasue it is superior.  But I
am kinda stumped on what areas to compare the two.

If you could help me out in suggesting some possible areas of comparison.
Keeping in mind that I need about the same amount of info on both PHP and
ASP.  Also if you could point me in the right direction by including some
web links that deal with the topic.

Thank You,
Jake



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: PHP vs. ASP

2002-01-09 Thread Julio Nobrega Trabalhando

  Database is a good point. PHP has native support for several, while I
believe ASP do not (through ODBC).

  Modules, and their price. At least I heard in ASP you have to pay for some
of them (well, more than those on PHP).

  Typecast? I am not sure if in ASP you have to, I remember I heard
somewhere. Like int var = 10

  Overall, how fast developers fix bugs is also a good thing... I remeber I
have seen bugs corrected on PHP only after 15 being reported..

  I have never programmed on ASP, these are just stuff I heard in some
places... So sorry for the lack of objectiveness (spelling on that? :-)).

--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Sessions don't load

2002-01-09 Thread Andrey Hristov

when session_start() is called for a first time, it generates session_id and set a 
cookie for the browser. The common name for the
cookie is PHPSESSID. You receive it on the refresh, because after the first load this 
cookie is known by the browser. When you hit
the page for a first time, there is no set PHPSESSID cookie, so PHP WILL NOT have 
$GLOBALS['PHPSESSID'] variable (assuming
register_globals is on in php.ini).
If you want the id. Get it from session_id().

HTH

Regards,
Andrey Hristov
- Original Message -
From: Ryan Kelley [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 09, 2002 4:02 PM
Subject: [PHP] Sessions don't load


 I have got a page that i am loading sessions on with the following code:

 session_start();
 $HTTP_SESSION_VARS['sess_id']=$PHPSESSID;

 Except that it will not assign an actual value until i hit refresh on my
 browser. Any ideas for a fix?

 Thanks in advance,

 Ryan Kelley



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Regex question

2002-01-09 Thread Stefan Rusterholz

 Hi all,

 I've got a regex that's working fine, apart from one little problem.

 $tags = array (script,
!--!\[CDATA\[,
\]\]--);

A quick shot (perhaps I miss the point ;): if you do
$x = \[;
then $x will contain [. If you then do a regex with preg_match(/$x/,
... eg. then it get's evaluated as preg_match(/[/, ...
If you want the [ to be escaped in the regex you have to double-escape it:
$x = \ \[; (sorry, the two \ should be together without a space but my
stupid mail-app converts the string thinking it's an network address)
so $x will contain \[ as you want ( the first backslash escapes the
second).

 foreach ($tags as $currentTag)
   if (preg_match (/^\/. $currentTag. /, $content))
 // do something


 Witan Jardine
 13 Southampton Place
 London WC1A 2AL
 Tel: 020 7404 4004

I hope I didn't miss the point and could help you
best regards
Stefan Rusterholz


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Regex question

2002-01-09 Thread Jon Haworth

 If you want the [ to be escaped in the regex you have to double-escape
it:
 $x = \ \[; (sorry, the two \ should be together without a space but my
 stupid mail-app converts the string thinking it's an network address)
 so $x will contain \[ as you want ( the first backslash escapes the
 second).

Hi Stefan,

Thanks very much for that, it does make sense :-)

Unfortunately it still hasn't fixed the problem... I suppose my question has
now boiled down to do I need to escape !, , or - in a regex? :-)

Cheers
Jon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] inserting a file into MSSQL

2002-01-09 Thread Jimmy

Hi Peter,

 Does anyone have a link to a good reference on how to insert a binary file
 (zip file) into MSSQL?

why do you want to store binary file in DB?
It's more efficient to store the file in filesystem, and in DB only
store the path of the file.
Unless you really have a good reason and left with no option
other than store the file in DB.

--
Jimmy

Brigands will demand your money or your life, but a woman will demand both.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Regex question

2002-01-09 Thread Stefan Rusterholz


  If you want the [ to be escaped in the regex you have to double-escape
 it:
  $x = \ \[; (sorry, the two \ should be together without a space but my
  stupid mail-app converts the string thinking it's an network address)
  so $x will contain \[ as you want ( the first backslash escapes the
  second).

 Hi Stefan,

 Thanks very much for that, it does make sense :-)

 Unfortunately it still hasn't fixed the problem... I suppose my question
has
 now boiled down to do I need to escape !, , or - in a regex? :-)

 Cheers
 Jon

here the expression again:
$tags = array (script,
   !--!\[CDATA\[,
   \]\]--);
foreach ($tags as $currentTag)
  if (preg_match (/^\/. $currentTag. /, $content))
   // do something

As far as I can see (notice: I'm not a regex-king ;) the regex seems correct
to me. The only thing I'm wondering about is the /^ (second last line of
the citation). Together with your expression in the array it results in
preg_match(/\/!\[CDATA\[/, ...)
I'm wondering if that (/![CDATA...) is really what you want to match (and
not only ![CDATA without the trailing /).

If it's not that then I suggest you to do simple example scripts where you
have none-dynamic regex's to test if the expression works (that's the way I
do that stuff - no really because I ever think I'd THIS TIME be able to do
it without, but I haven't thought right till today ;)

lot of luck mastering your expressions
stefan rusterholz


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] php sockets!- urg!!!

2002-01-09 Thread Sandeep Murphy


Hi,

I am opening a socket on a remote server(weblogic) and sending my username
and psswd to authentify them...

I figure my php is opening the socket as no errors r being trapped.. However
the response is a blank page instead of an xml formatted response...why???
how can i rectify this??

Please helpp!!!

TIA,
sands
my code is as below:


?php

$uname = username;
$password = password;

?



?php

$Destination = http://srv157:7001/communicatorServlet;;
$Request = username=$unamepassword=$password;
$cfgTimeOut= 20;

$theURL = parse_url($Destination);
$host = $theURL[host];
$path = $theURL[path];
$port = $theURL[port]; if ($port==) $port=80;
$header  = GET .$path. HTTP/1.0\r\n;
$header .= Host: .$host.\r\n;
$header .= Accept: */*\r\n;
$header .= Accept-Language: en\r\n;
$header .= User-Agent: PHP/4.0.6 (Apache/1.3.20)\r\n\r\n;
$header .= Content-Type: text/xml\r\n;
$header .= Content-Length: .strlen($Request).\r\n;
$header .= Content: \r\n\r\n;
$msg = $header . $Request;
$Response = ;



// open a socket
if(!$cfgTimeOut)
// without timeout
$fp = fsockopen($host,$port);
else
 // with timeout
$fp = fsockopen($host,$port, $errno, $errstr, $cfgTimeOut);


if ($fp) {
  if (!fputs($fp,$msg,strlen($msg))) { return false; }  // S
E N D
  
  while (!feof($fp)) {$Response .= fgets($fp,32768);} 
  
fclose($fp); // R E C E I V E

  } else 
  {
  echo Unable to access servlet (.$Destination.).br;
  
  echo a
href=\javascript:history.go(-1)\Try another/a;}

  print $response\n;
  
  print hello;
?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: PHP vs. ASP

2002-01-09 Thread Robert Klinkenberg

Well, I personally prefer PHP over ASP because better support from
webhosting companies, but ASP has some good points.
This is especially the case if you can setup the complete hosting
environment yourself and have some money to spend.

First of all databases. PHP has support for a limited but interesting list
of databases, especially the support for mysql and postgres is handy for a
webserver. On the other hand, ASP has good support for most bussiness
servers (ORACLE MS SQL Server,) with OLE-DB and a lot more databases
with ODBC.

The development tools. Definately a win for ASP (with vb.net C# and C++ you
have a complete IDE and with Dreamweaver Ultradev you can pretty much point
and click. SO you can choose whatever tool you like.
PHP has very limited IDE's.

Price. ASP solutions are mostly build with Windows 2000 Server and MS SQL
Server or Oracle and an expensive IDE. So it's pretty expensive to build.
PHP is mostly used with Linux, Apache and MySQL and is a lot cheaper (you
only need to buy the hardware and the software is virtually free)

Programming language: This is off course a personal taste but with ASP
(.net) you can use VB/C++/C#. So if you are used to VB or C++ it's a bit
easier to start with.

Modules. Both have a lot of free tools available. However I personally find
the PHP modules more usefull. (With the exception of the Crystal Report
generator in .net, pretty usable reports without a lot of work).

It's a bit easier for a novice to get started with ASP as with PHP, and it's
pertty easy to make the project look good.

So, if you have the cash and some inexperienced programmers working for you
ASP is the save bet. If you have a small company, are a student, depend on
webhosting or are a pretty experienced programmer, PHP might be a better
choose.

Robert Klinkenberg

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: PHP vs. ASP

2002-01-09 Thread Dean Ouellette

I am a newbie to programming,  ASP is easier to learn?  I heard PHP was


At 04:48 PM 1/9/2002 +0100, Robert Klinkenberg wrote:
Well, I personally prefer PHP over ASP because better support from
webhosting companies, but ASP has some good points.
This is especially the case if you can setup the complete hosting
environment yourself and have some money to spend.

First of all databases. PHP has support for a limited but interesting list
of databases, especially the support for mysql and postgres is handy for a
webserver. On the other hand, ASP has good support for most bussiness
servers (ORACLE MS SQL Server,) with OLE-DB and a lot more databases
with ODBC.

The development tools. Definately a win for ASP (with vb.net C# and C++ you
have a complete IDE and with Dreamweaver Ultradev you can pretty much point
and click. SO you can choose whatever tool you like.
PHP has very limited IDE's.

Price. ASP solutions are mostly build with Windows 2000 Server and MS SQL
Server or Oracle and an expensive IDE. So it's pretty expensive to build.
PHP is mostly used with Linux, Apache and MySQL and is a lot cheaper (you
only need to buy the hardware and the software is virtually free)

Programming language: This is off course a personal taste but with ASP
(.net) you can use VB/C++/C#. So if you are used to VB or C++ it's a bit
easier to start with.

Modules. Both have a lot of free tools available. However I personally find
the PHP modules more usefull. (With the exception of the Crystal Report
generator in .net, pretty usable reports without a lot of work).

It's a bit easier for a novice to get started with ASP as with PHP, and it's
pertty easy to make the project look good.

So, if you have the cash and some inexperienced programmers working for you
ASP is the save bet. If you have a small company, are a student, depend on
webhosting or are a pretty experienced programmer, PHP might be a better
choose.

Robert Klinkenberg

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Sessions

2002-01-09 Thread Johnson, Kirk

PHPSESSID will not be set on the first request. On the first request to a
page with session_start(), PHP creates a session and sends a cookie named
PHPSESSID to the browser. When the browser returns the cookie in the next
request, PHPSESSID gets put into $HTTP_COOKIE_VARS[] array, and if
register_globals is on, it also gets put into the global variable space.

If you need the session ID on the first request, it is availabe in the
constant SID. Try putting this into your code and see what you get:

echo SID is  . SID . br;

I believe you can also do something like:

$PHPSESSID = session_id();
echo PHPSESSID is $PHPSESSID;

Kirk

 -Original Message-
 From: Ryan Kelley [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 08, 2002 7:13 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Sessions
 
 
 I actually fixed the problem with the following code:
 
 session_start();
 $HTTP_SESSION_VARS['sess_id']=$PHPSESSID;
 
 Except that it will not assign an actual value until i hit 
 refress on my
 browser. Any ideas for a fix?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Newbie

2002-01-09 Thread Kevin P

Hi

I am trying to keep information that is input via a form. This form may be
used 1, 2, 3, 4 or more times for each entry. Meaning that the form will be
filled out and added then another of the same form filled our and so on
until the person clicks the the complete button.

Can I hold this info by session or do I have to insert it into the database
after each time? I would rather not put it into the database until the
session  is complete and they have a chance to verify their entry.

Thanks
Kevin



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Regex question

2002-01-09 Thread Jon Haworth

 As far as I can see (notice: I'm not a regex-king ;) the regex seems
correct
 to me. The only thing I'm wondering about is the /^ (second last line
of
 the citation). Together with your expression in the array it results in
 preg_match(/\/!\[CDATA\[/, ...)
 I'm wondering if that (/![CDATA...) is really what you want to match
(and
 not only ![CDATA without the trailing /).


Aaarrgh thump thump thump thump thump

That's it! Thanks very much Stefan. 

It's trying to match a closing HTML tag, but of course that doesn't apply to
CDATA, so it all went pear-shaped. I stared at that bloody regex for hours,
as well sigh

Cheers
Jon







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] php,sockets-help!

2002-01-09 Thread Sandeep Murphy


Hi,

I am opening a socket on a remote server(weblogic) and sending my username
and psswd to authentify them...

I figure my php is opening the socket as no errors r being trapped.. However
the response is a blank page instead of an xml formatted response...why???
how can i rectify this??

Please helpp!!!

TIA,
sands
my code is as below:


?php

$uname = username;
$password = password;

?



?php

$Destination = http://srv157:7001/communicatorServlet;;
$Request = username=$unamepassword=$password;
$cfgTimeOut= 20;

$theURL = parse_url($Destination);
$host = $theURL[host];
$path = $theURL[path];
$port = $theURL[port]; if ($port==) $port=80;
$header  = GET .$path. HTTP/1.0\r\n;
$header .= Host: .$host.\r\n;
$header .= Accept: */*\r\n;
$header .= Accept-Language: en\r\n;
$header .= User-Agent: PHP/4.0.6 (Apache/1.3.20)\r\n\r\n;
$header .= Content-Type: text/xml\r\n;
$header .= Content-Length: .strlen($Request).\r\n;
$header .= Content: \r\n\r\n;
$msg = $header . $Request;
$Response = ;



// open a socket
if(!$cfgTimeOut)
// without timeout
$fp = fsockopen($host,$port);
else
 // with timeout
$fp = fsockopen($host,$port, $errno, $errstr, $cfgTimeOut);


if ($fp) {
  if (!fputs($fp,$msg,strlen($msg))) { return false; }  // S
E N D
  
  while (!feof($fp)) {$Response .= fgets($fp,32768);} 
  
fclose($fp); // R E C E I V E

  } else 
  {
  echo Unable to access servlet (.$Destination.).br;
  
  echo a
href=\javascript:history.go(-1)\Try another/a;}

  print $response\n;
  
  print hello;
?

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Newbie

2002-01-09 Thread Julio Nobrega Trabalhando

  Both ways. I would use session if the form(s) must be completed at once.
If someone can save forms 1 and 2 and another day return to complete the
remaining steps, then a database might be better.

  Also, if you use a database to hold temp info that must fly between the
forms, you would have to write more code (of if/else {
SELECT/INSERT/UPDATE/DELETE), and the performance overhead of so many db
queries might not be a good idea.

  Can't afirm 100% since I don't know your complete enviroment, but from
what you told and my personal experience, I would go with sessions.

--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca

Ajudei? Salvei? Que tal um presentinho?
http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884


Kevin P [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi

 I am trying to keep information that is input via a form. This form may be
 used 1, 2, 3, 4 or more times for each entry. Meaning that the form will
be
 filled out and added then another of the same form filled our and so on
 until the person clicks the the complete button.

 Can I hold this info by session or do I have to insert it into the
database
 after each time? I would rather not put it into the database until the
 session  is complete and they have a chance to verify their entry.

 Thanks
 Kevin





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] php,sockets-help!

2002-01-09 Thread Andrey Hristov

Probably here :
$header .= User-Agent: PHP/4.0.6 (Apache/1.3.20)\r\n\r\n;
you have two new lines instead of one.

HTH

Regards,
Andrey Hristov
- Original Message - 
From: Sandeep Murphy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 09, 2002 6:23 PM
Subject: [PHP] php,sockets-help!


 
 Hi,
 
 I am opening a socket on a remote server(weblogic) and sending my username
 and psswd to authentify them...
 
 I figure my php is opening the socket as no errors r being trapped.. However
 the response is a blank page instead of an xml formatted response...why???
 how can i rectify this??
 
 Please helpp!!!
 
 TIA,
 sands
 my code is as below:
 
 
 ?php
 
 $uname = username;
 $password = password;
 
 ?
 
 
 
 ?php
 
 $Destination = http://srv157:7001/communicatorServlet;;
 $Request = username=$unamepassword=$password;
 $cfgTimeOut= 20;
 
 $theURL = parse_url($Destination);
 $host = $theURL[host];
 $path = $theURL[path];
 $port = $theURL[port]; if ($port==) $port=80;
 $header  = GET .$path. HTTP/1.0\r\n;
 $header .= Host: .$host.\r\n;
 $header .= Accept: */*\r\n;
 $header .= Accept-Language: en\r\n;
 $header .= User-Agent: PHP/4.0.6 (Apache/1.3.20)\r\n\r\n;
 $header .= Content-Type: text/xml\r\n;
 $header .= Content-Length: .strlen($Request).\r\n;
 $header .= Content: \r\n\r\n;
 $msg = $header . $Request;
 $Response = ;
 
 
 
 // open a socket
 if(!$cfgTimeOut)
 // without timeout
 $fp = fsockopen($host,$port);
 else
 // with timeout
 $fp = fsockopen($host,$port, $errno, $errstr, $cfgTimeOut);
 
 
 if ($fp) {
   if (!fputs($fp,$msg,strlen($msg))) { return false; }  // S
 E N D
   
   while (!feof($fp)) {$Response .= fgets($fp,32768);} 
   
 fclose($fp); // R E C E I V E
 
   } else 
   {
   echo Unable to access servlet (.$Destination.).br;
   
   echo a
 href=\javascript:history.go(-1)\Try another/a;}
 
   print $response\n;
   
   print hello;
 ?
 
 -- 
 PHP Windows Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] php,sockets-help!

2002-01-09 Thread Bogdan Stancescu

Plus, isn't your request content-type: application/x-www-form-urlencoded?

And another thing, since you send all the headers HTTP 1.1 compatible, why don't
you use it instead of 1.0?

Bogdan

Sandeep Murphy wrote:

 Hi,

 I am opening a socket on a remote server(weblogic) and sending my username
 and psswd to authentify them...

 I figure my php is opening the socket as no errors r being trapped.. However
 the response is a blank page instead of an xml formatted response...why???
 how can i rectify this??



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: PHP vs. ASP

2002-01-09 Thread Nicolas Costes

Well, I don't know ASP, but I fonud that learning PHP was really easy when 
you already know C, C++  And no variables types, pointer, etc ... is 
great !!!

Le Mercredi 9 Janvier 2002 17:01, Dean Ouellette a écrit :
 I am a newbie to programming,  ASP is easier to learn?  I heard PHP was

 At 04:48 PM 1/9/2002 +0100, Robert Klinkenberg wrote:
 Well, I personally prefer PHP over ASP because better support from
 webhosting companies, but ASP has some good points.
 This is especially the case if you can setup the complete hosting
 environment yourself and have some money to spend.
 
 First of all databases. PHP has support for a limited but interesting list
 of databases, especially the support for mysql and postgres is handy for a
 webserver. On the other hand, ASP has good support for most bussiness
 servers (ORACLE MS SQL Server,) with OLE-DB and a lot more databases
 with ODBC.
 
 The development tools. Definately a win for ASP (with vb.net C# and C++
  you have a complete IDE and with Dreamweaver Ultradev you can pretty much
  point and click. SO you can choose whatever tool you like.
 PHP has very limited IDE's.
 
 Price. ASP solutions are mostly build with Windows 2000 Server and MS SQL
 Server or Oracle and an expensive IDE. So it's pretty expensive to build.
 PHP is mostly used with Linux, Apache and MySQL and is a lot cheaper (you
 only need to buy the hardware and the software is virtually free)
 
 Programming language: This is off course a personal taste but with ASP
 (.net) you can use VB/C++/C#. So if you are used to VB or C++ it's a bit
 easier to start with.
 
 Modules. Both have a lot of free tools available. However I personally
  find the PHP modules more usefull. (With the exception of the Crystal
  Report generator in .net, pretty usable reports without a lot of work).
 
 It's a bit easier for a novice to get started with ASP as with PHP, and
  it's pertty easy to make the project look good.
 
 So, if you have the cash and some inexperienced programmers working for
  you ASP is the save bet. If you have a small company, are a student,
  depend on webhosting or are a pretty experienced programmer, PHP might be
  a better choose.
 
 Robert Klinkenberg
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
 ( * Nicolas Costes,
 //\\  IUT de La Roche / Yon
( \/ ) [EMAIL PROTECTED]
http://luxregina.free.fr

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] postgres

2002-01-09 Thread aurelio

somebody can help me, does not obtain to discover because this error with postgres 
happens? 

  Warning: PostgresSQL query failed: ERROR: pollolitoral_cidade: Permission denied. in 
../php3/pg_functions.php3 on line 172
   
Thanks,
Aurélio Sabino



[PHP] Re: PHP vs. ASP

2002-01-09 Thread Philip Hallstrom

I don't want to start a war, but last time I looked PHP had native support
for every database I'd ever heard of including Oracle, SQLServer, etc...

Just don't want the guy doing the report that php is database limited...

On Wed, 9 Jan 2002, Robert Klinkenberg wrote:

 Well, I personally prefer PHP over ASP because better support from
 webhosting companies, but ASP has some good points.
 This is especially the case if you can setup the complete hosting
 environment yourself and have some money to spend.

 First of all databases. PHP has support for a limited but interesting list
 of databases, especially the support for mysql and postgres is handy for a
 webserver. On the other hand, ASP has good support for most bussiness
 servers (ORACLE MS SQL Server,) with OLE-DB and a lot more databases
 with ODBC.

 The development tools. Definately a win for ASP (with vb.net C# and C++ you
 have a complete IDE and with Dreamweaver Ultradev you can pretty much point
 and click. SO you can choose whatever tool you like.
 PHP has very limited IDE's.

 Price. ASP solutions are mostly build with Windows 2000 Server and MS SQL
 Server or Oracle and an expensive IDE. So it's pretty expensive to build.
 PHP is mostly used with Linux, Apache and MySQL and is a lot cheaper (you
 only need to buy the hardware and the software is virtually free)

 Programming language: This is off course a personal taste but with ASP
 (.net) you can use VB/C++/C#. So if you are used to VB or C++ it's a bit
 easier to start with.

 Modules. Both have a lot of free tools available. However I personally find
 the PHP modules more usefull. (With the exception of the Crystal Report
 generator in .net, pretty usable reports without a lot of work).

 It's a bit easier for a novice to get started with ASP as with PHP, and it's
 pertty easy to make the project look good.

 So, if you have the cash and some inexperienced programmers working for you
 ASP is the save bet. If you have a small company, are a student, depend on
 webhosting or are a pretty experienced programmer, PHP might be a better
 choose.

 Robert Klinkenberg

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] postgres

2002-01-09 Thread Dave

suggestion would be to post a snippet of the relavent code...  say lines 160 to
175 or something like that.  Troubleshooting across the etherial plane is
expensive.

Dave

-Original Message-
From: aurelio [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 09, 2002 12:48 PM
To: [EMAIL PROTECTED]
Subject: [PHP] postgres


somebody can help me, does not obtain to discover because this error
with postgres happens?

  Warning: PostgresSQL query failed: ERROR: pollolitoral_cidade:
Permission denied. in ../php3/pg_functions.php3 on line 172

Thanks,
Aurélio Sabino



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] problems with urlencoding

2002-01-09 Thread V

try rawurlencode() and rawurldecode()

Salu2,

V

-Mensaje original-
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Enviado el: jueves 27 de diciembre de 2001 3:46
Para: [EMAIL PROTECTED]
Asunto: [PHP] problems with urlencoding


Hi,
I try to send the content of a variable about the url to the next php-page.
The content of the variable is:
Client like '%4022720893%'
I have tried urlencode and urldecode, but this does not work
If I put this variable to an url, I got always
Client like '@22720893%'
(depending from the number after the first %),
I also have tried to mask with slashes and stripslashes. But this does also
not work.
Who can help and has the best way to send this content thru an url
best regards
christian


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: PHP vs. ASP

2002-01-09 Thread Michael Kimsal

Philip Hallstrom wrote:

 I don't want to start a war, but last time I looked PHP had native support
 for every database I'd ever heard of including Oracle, SQLServer, etc...
 
 Just don't want the guy doing the report that php is database limited...
 


Native support can mean different things, I think.  Native to the language?  

Not really - there are wrapper functions which can be compiled in which 
wrap around third party libraries to give PHP access to those libraries.

The windows port comes with many DLLs, but that's just it - they are 
DLLs.  If I use a DLL to create a graphic in ASP, everyone points out 
that you have to use all these third party modules whereas PHP can do 
it 'natively', which is at best an unfair comparison.

If PHP had 'native' support for SQLServer, I wouldn't have to go fetch 
and compile the freetds library to get SQLServer connections to work 
under Linux.

Michael Kimsal
http://www.tapinternet.com/php/
PHP Training Courses
734-480-9961




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] RE: serial array vs. hash....

2002-01-09 Thread Tim Ward

As far as I know all arrays in php are hash arrays. Your serial array is
actually a hash array with numeric keys, so in your example using numeric
keys and having to loop through them has nothing going for it.

I'm sure someone will tell me if I'm wrong.

Tim
www.chessish.com http://www.chessish.com 

--
From:  Eric McKeown [SMTP:[EMAIL PROTECTED]]
Sent:  09 January 2002 05:53
To:  [EMAIL PROTECTED]
Subject:  serial array vs. hash

Hi folks,

Quick question about the performance implications of looking up info
in
a hash (associative array) vs. looking it up in a serial array.  I
have
a script that will be running a function (actually several similar
functions) up to 1500 times to verify that certain data values are
in a
valid list.  My list might have anywhere from 2 to 100 valid values.
I
could store the list in a conventional serial array...

$valid[0] = Valid One;
$valid[1] = Valid Two;
$valid[2] = Valid Three;
.
and so on, and then use a for loop to iterate through the contents
of
the array each time that I need to check to see if I have a valid
value.  On the other hand, I could create a hash that looks like...

$valid[Valid One] = some value;
$valid[Valid Two] = some other value;

and so on, and then simply check to see if the entry exists in the
associative array in order to determine whether it is valid.  I
suspect
that the latter method would be much more efficient, and I intend to
test the two techniques myself to find out, but I just thought I
would
check here to see if anyone could confirm or refute my hunch

Thanks for your help,

Eric


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: PHP vs. ASP

2002-01-09 Thread Stephen Abshire

I agree about not starting a war between PHP and ASP. We already have one 
going on that is out of hand between Linux and Windows :-)

I do think it is up to how you view things. When I think of support being 
native I think of that meaning that something can perform a task using 
only its own internal capabilities. So in the case of PHP and say Oracle 
this would mean that PHP could connect to and utilize data in an Oracle 
database using only functionality that is built into PHP itself. But if you 
look at http://www.php.net/manual/en/ref.oci8.php you will find that you 
need to install the Oracle 8 Client Libraries if you want to use the Oracle 
8 PHP functions. So is this really native support? You can make your own 
decision on that one :-)

I am a professional web application developer and the consulting firm I work 
for leans heavily toward the Microsoft side so I am very familiar with ASP. 
I also do PHP on the side and have had one assignment doing PHP on my job.

* My personal preference is PHP because the language is so elegant and I 
like the cross-platorm aspect of PHP as well.

* PHP seems to be supported MUCH better than ASP.

* The PHP development cycle is more current.

* Possibly the biggest thing I like about PHP over ASP is dynamic includes. 
Those developers out there know what I mean about this one. Including a file 
dynamically say from a database field or some other approach. Believe it or 
not this really opens up a lot of doors in your development.

Just my personal opinions and you will find probably everyone on this list 
will have their own. But that is fine too. It my be best to look at the 
problem to be solved then choose the platform and language that will best 
solve it.


Original Message Follows
From: Philip Hallstrom [EMAIL PROTECTED]
To: Robert Klinkenberg [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: [PHP] Re: PHP vs. ASP
Date: Wed, 9 Jan 2002 08:51:40 -0800 (PST)

I don't want to start a war, but last time I looked PHP had native support
for every database I'd ever heard of including Oracle, SQLServer, etc...

Just don't want the guy doing the report that php is database limited...

On Wed, 9 Jan 2002, Robert Klinkenberg wrote:

  Well, I personally prefer PHP over ASP because better support from
  webhosting companies, but ASP has some good points.
  This is especially the case if you can setup the complete hosting
  environment yourself and have some money to spend.
 
  First of all databases. PHP has support for a limited but interesting 
list
  of databases, especially the support for mysql and postgres is handy for 
a
  webserver. On the other hand, ASP has good support for most bussiness
  servers (ORACLE MS SQL Server,) with OLE-DB and a lot more databases
  with ODBC.
 
  The development tools. Definately a win for ASP (with vb.net C# and C++ 
you
  have a complete IDE and with Dreamweaver Ultradev you can pretty much 
point
  and click. SO you can choose whatever tool you like.
  PHP has very limited IDE's.
 
  Price. ASP solutions are mostly build with Windows 2000 Server and MS SQL
  Server or Oracle and an expensive IDE. So it's pretty expensive to build.
  PHP is mostly used with Linux, Apache and MySQL and is a lot cheaper (you
  only need to buy the hardware and the software is virtually free)
 
  Programming language: This is off course a personal taste but with ASP
  (.net) you can use VB/C++/C#. So if you are used to VB or C++ it's a bit
  easier to start with.
 
  Modules. Both have a lot of free tools available. However I personally 
find
  the PHP modules more usefull. (With the exception of the Crystal Report
  generator in .net, pretty usable reports without a lot of work).
 
  It's a bit easier for a novice to get started with ASP as with PHP, and 
it's
  pertty easy to make the project look good.
 
  So, if you have the cash and some inexperienced programmers working for 
you
  ASP is the save bet. If you have a small company, are a student, depend 
on
  webhosting or are a pretty experienced programmer, PHP might be a better
  choose.
 
  Robert Klinkenberg
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Re: PHP vs. ASP

2002-01-09 Thread Neil Kimber

You should probably consider ASP.NET. Visual Studio .NET is out in early Feb
and ASP.NET makes an enormous leap in functionality. It should almost be
considered a new web development environment.
It allows development in any CLR compliant language (straight VB.NET, C#,
managed C++ etc..)
It cleanly separates UI and program logic
Has better OO implementation than PHP
Has easier web design (web forms)
Has embedded state managment (run at server tags for form fields)
Allows for easily extending and creating .NET complient form controls

For me the biggest attraction is the ability to use and mix and match any
CLR compliant language. You can now develop a windows client app and as long
as you cleanly separate the business layer from the UI layer you can re-use
the same business layer in your web apps. Indeed MS are currently working on
the Universal Canvas, which 'may' lead to re-usable windows/web UIs.

Big downside? Has to run on MS platform.

 -Original Message-
 From: Stephen Abshire [mailto:[EMAIL PROTECTED]]
 Sent: 09 January 2002 17:27
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Re: PHP vs. ASP


 I agree about not starting a war between PHP and ASP. We already have one
 going on that is out of hand between Linux and Windows :-)

 I do think it is up to how you view things. When I think of support being
 native I think of that meaning that something can perform a task using
 only its own internal capabilities. So in the case of PHP and say Oracle
 this would mean that PHP could connect to and utilize data in an Oracle
 database using only functionality that is built into PHP itself.
 But if you
 look at http://www.php.net/manual/en/ref.oci8.php you will find that you
 need to install the Oracle 8 Client Libraries if you want to use
 the Oracle
 8 PHP functions. So is this really native support? You can make
 your own
 decision on that one :-)

 I am a professional web application developer and the consulting
 firm I work
 for leans heavily toward the Microsoft side so I am very familiar
 with ASP.
 I also do PHP on the side and have had one assignment doing PHP on my job.

 * My personal preference is PHP because the language is so elegant and I
 like the cross-platorm aspect of PHP as well.

 * PHP seems to be supported MUCH better than ASP.

 * The PHP development cycle is more current.

 * Possibly the biggest thing I like about PHP over ASP is dynamic
 includes.
 Those developers out there know what I mean about this one.
 Including a file
 dynamically say from a database field or some other approach.
 Believe it or
 not this really opens up a lot of doors in your development.

 Just my personal opinions and you will find probably everyone on
 this list
 will have their own. But that is fine too. It my be best to look at the
 problem to be solved then choose the platform and language that will best
 solve it.


 Original Message Follows
 From: Philip Hallstrom [EMAIL PROTECTED]
 To: Robert Klinkenberg [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 Subject: [PHP] Re: PHP vs. ASP
 Date: Wed, 9 Jan 2002 08:51:40 -0800 (PST)

 I don't want to start a war, but last time I looked PHP had native support
 for every database I'd ever heard of including Oracle, SQLServer, etc...

 Just don't want the guy doing the report that php is database limited...

 On Wed, 9 Jan 2002, Robert Klinkenberg wrote:

   Well, I personally prefer PHP over ASP because better support from
   webhosting companies, but ASP has some good points.
   This is especially the case if you can setup the complete hosting
   environment yourself and have some money to spend.
  
   First of all databases. PHP has support for a limited but interesting
 list
   of databases, especially the support for mysql and postgres is
 handy for
 a
   webserver. On the other hand, ASP has good support for most bussiness
   servers (ORACLE MS SQL Server,) with OLE-DB and a lot more
 databases
   with ODBC.
  
   The development tools. Definately a win for ASP (with vb.net
 C# and C++
 you
   have a complete IDE and with Dreamweaver Ultradev you can pretty much
 point
   and click. SO you can choose whatever tool you like.
   PHP has very limited IDE's.
  
   Price. ASP solutions are mostly build with Windows 2000 Server
 and MS SQL
   Server or Oracle and an expensive IDE. So it's pretty
 expensive to build.
   PHP is mostly used with Linux, Apache and MySQL and is a lot
 cheaper (you
   only need to buy the hardware and the software is virtually free)
  
   Programming language: This is off course a personal taste but with ASP
   (.net) you can use VB/C++/C#. So if you are used to VB or C++
 it's a bit
   easier to start with.
  
   Modules. Both have a lot of free tools available. However I personally
 find
   the PHP modules more usefull. (With the exception of the Crystal Report
   generator in .net, pretty usable reports without a lot of work).
  
   It's a bit easier for a novice to get started with ASP as with
 PHP, and
 it's
   

RE: [PHP] functions...

2002-01-09 Thread Robert V. Zwink

More about this here:
http://www.php.net/manual/en/function.func-get-arg.php

Robert Zwink
http://www.zwink.net/daid.php

-Original Message-
From: Chris Hall [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 08, 2002 9:48 PM
To: [EMAIL PROTECTED]
Subject: [PHP] functions...


function lala() {

do i HAVE to define a variable or argument eg

function lala($var) {

or can i use it like:

lala($stmt);

will $stmt become part of the function?


--
Chris Hall
hardwired industries



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] RE: PHP vs. ASP

2002-01-09 Thread Robert Klinkenberg

Off course PHP does support Oracle and the like. What I wanted to say is
that PHP support most common databases, but if your company needs support
for some strange database you can't access it very fast and easily
(especially when you use PHP on Unix). On the other hand with ASP you can
access anything that has an ODBC driver with a reasonable speed. And there
are a whole lot more databases out there than the say 10-20 PHP supports
directly.

However, the support in PHP works pretty well 95% of the time for me, but
this is something where Microsofts size is an advantage, they can (and have
with ODBC) create an industry standard, and database vendors actively spend
time and resources to create a stable and fast interface to Microsoft
products. 

By the way, you can use iODBC in PHP to access ODBC databases but it is a
bit slow for me :-(

Robert Klinkenberg

-Oorspronkelijk bericht-
Van: Philip Hallstrom [mailto:[EMAIL PROTECTED]]
Verzonden: Wednesday, January 09, 2002 5:52 PM
Aan: Robert Klinkenberg
CC: [EMAIL PROTECTED]
Onderwerp: Re: PHP vs. ASP


I don't want to start a war, but last time I looked PHP had native support
for every database I'd ever heard of including Oracle, SQLServer, etc...

Just don't want the guy doing the report that php is database limited...

On Wed, 9 Jan 2002, Robert Klinkenberg wrote:

 Well, I personally prefer PHP over ASP because better support from
 webhosting companies, but ASP has some good points.
 This is especially the case if you can setup the complete hosting
 environment yourself and have some money to spend.

 First of all databases. PHP has support for a limited but interesting list
 of databases, especially the support for mysql and postgres is handy for a
 webserver. On the other hand, ASP has good support for most bussiness
 servers (ORACLE MS SQL Server,) with OLE-DB and a lot more databases
 with ODBC.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP vs. ASP

2002-01-09 Thread Shane Wright

Hi

Something I dont think anyone's mentioned yet is that PHP is also great for 
running stuff from the command line - e.g. for background scripts for a site 
or mailing scripts or whatever...

In case that doesnt sound so useful, it measn you can use all the same 
libraries for the online site as for the offline processing bits :)

--
Shane

On Wednesday 09 Jan 2002 1:43 pm, Jake wrote:
 Hello there, I need some help.

 I have to do a technical report(about 2200 words) comparing PHP to ASP.  I
 have already decided to make PHP the winner becasue it is superior.  But I
 am kinda stumped on what areas to compare the two.

 If you could help me out in suggesting some possible areas of comparison.
 Keeping in mind that I need about the same amount of info on both PHP and
 ASP.  Also if you could point me in the right direction by including some
 web links that deal with the topic.

 Thank You,
 Jake

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Limiting CPU usage/time of spawned processes

2002-01-09 Thread Mike Eheler

Hi There,

Okay, I have a server that allows a couple hundred virtual hosts that we 
have run websites as we are a hosting company. Recently one of our 
customers decided to spawn lynx through PHP. The process was running at 
80% cpu for over 400 minutes, and it appears that Apache's RLimitCPU 
directive had no effect on this.

Is there any directives in PHP which can perform the same feat (i.e. 
killing a process for running for too long, or limiting it's CPU usage).

Thanks,
 Mike


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] echo problem NEW

2002-01-09 Thread Paul Burney

on 1/9/02 8:17 AM, Henning Sprang at [EMAIL PROTECTED] appended the
following bits to my mbox:

 just another one - but i am too out of practice with html standarts to
 know if this is compliant ( a browser showing a result doesn't
 neccessary mean it's standarts compliant!)

FYI:

By default, SGML requires that all attribute values be delimited using
either double quotation marks (ASCII decimal 34) or single quotation marks
(ASCII decimal 39). Single quote marks can be included within the attribute
value when the value is delimited by double quote marks, and vice versa.
Authors may also use numeric character references to represent double quotes
(#34;) and single quotes (#39;). For double quotes authors can also use
the character entity reference quot;.

From:

http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2

HTH.

Paul Burney

?php
while ($self != asleep) {
$sheep_count++;
}
?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: PHP vs. ASP

2002-01-09 Thread Mike Eheler

Well being a former ASP programmer and a current PHP programmer I think 
I can help you there.

The key point is ease of use. PHP provides far more functionality than 
ASP (try finding a function to print out the date in ASP.. yeah, I 
thought so), while at the same time giving you access to low-level areas 
of the language so that you can really make it do whatever you want.

Oh yeah, and it's OpenSource. Make it do what you want, and if that 
doesn't suit your fancy, then change it :)

ASP costs  -- the server (be it Windows or Unix-based) is gonna cost 
ya, any extensions to do more advanced things (such as creating images 
on the fly) is gonna cost ya.. cost cost cost.

With ASP I was constantly running into roadblocks because of the way it 
works. Let's take form submission.. or beyond that.. uploading FILES. 
You can do it the long, hard way (write your own MIME handler and parse 
the incoming binary data), or the easy way (shell out $$$ to pay for a 
professional activex com object to do the job for you).

And if that wasn't enough. ASP is just plain slower.

Well, that's my 2 cents. There's plenty of more points that could be 
said, but I think this should give you some good arguments to start with.

Mike

Jake wrote:

 Hello there, I need some help.
 
 I have to do a technical report(about 2200 words) comparing PHP to ASP.  I
 have already decided to make PHP the winner becasue it is superior.  But I
 am kinda stumped on what areas to compare the two.
 
 If you could help me out in suggesting some possible areas of comparison.
 Keeping in mind that I need about the same amount of info on both PHP and
 ASP.  Also if you could point me in the right direction by including some
 web links that deal with the topic.
 
 Thank You,
 Jake
 
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] quick question

2002-01-09 Thread Erik Price

Just a quick question -- I'm temporarily unsubbed so if anyone could CC 
me directly that would be great.

I'm trying to write my code in accordance with the PHP 4.1.0 security 
advisory -- that is, I want to use the $_GET and $_POST arrays when 
grabbing variables passed with GET and POST forms.  But how should I 
construct the variables for a switch statement?  I'm left confused, 
since these aren't written with the $ prefix as most variables are...
Should it be:
case _POST['insert']

or should it be:
case $_POST['select']

?

Thanks very much!

Erik

PS: I can't test it myself b/c my php.ini file is register_globals=on 
so I won't know the difference, but I'm curious for all future code I 
write to be compatible.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Form Problem

2002-01-09 Thread Chris Kwasneski

I'm having a problem with a HTML form.  When it gets submitted, I keep 
getting an undefined variable error message.  And a blank page (aside from 
a 'Hi' written on it...).  I don't think its a problem with my install of 
PHP as other PHP code is running fine, but can't get it to print out this 
name.  I'm probably missing something simple, but I just can't figure it out.

Any help would be appreciated.

the form:

html
  head
  titleMy Form/title
  /head
  body
  form action=test2.php method=GET

  My name is:
  br input type=text name=YourName

  input type=submit name=submit value=Submit /
  /form
  /body
  /html


Test2.php file:
html
head
titleForm test.../title
/head
body
Hi ?php echo $YourName; ?
/body
/html

The url that is getting passed to the file:

http://localhost/test2.php?YourName=Chrissubmit=Submit

The error message I'm getting:


[Wed Jan 09 14:24:47 2002] [error] [client 127.0.0.1] PHP 
Warning:  Undefined variable:  YourName in c:\program files\apache 
group\apache\htdocs\test2.php on line 10





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: How reliable is the 'user' in http://user@somehost.com/???

2002-01-09 Thread Philip Hallstrom

In looking into this more, while I can put stuff there, PHP doesn't pick
it up (or perhaps the browser doesn't send it) unless you do something
like this:

if ( !isset($PHP_AUTH_USER)  )  {
Header(WWW-Authenticate: Basic realm=\Foo\);
Header(HTTP/1.0 401 Unauthorized);
exit;
}

But in this case you have to supply both a user and password...

Rats.

-philip

On Tue, 8 Jan 2002, Philip Hallstrom wrote:

 Hi -
   For one of my projects I need to pass around a bit of information
 to all the pages.  The information is the same throughout and is the same
 for groups of clients.  Right now I just pass it on the query string, but
 it's getting cumbersome so I started looking into sessions and I see that
 I can do the $SID thing on the query string... and for some reason that
 reminded me that I've seen urls that look like this:

 http:[EMAIL PROTECTED]/somepath.html

 I've played around with it a little bit and it seems I can put whatever I
 want in for 'user' and that I can change it and that it sticks around
 for relative urls.  And it's in RFC 1738, but it doesn't say too much.

 So my questions are these:

 - how reliable is that syntax for passing data around?

 - is there a reason PHP can't use that for storing $SID?

 Thanks!

 -philip




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: PHP vs. ASP

2002-01-09 Thread Julio Nobrega Trabalhando

  Sorry,

corrected on PHP only after 15 being reported.. should read:

corrected on PHP only after 15 minutes being reported..

  That was a good thing I saw. I still remember, some exec() problems with
slashes and some letters on a specific plataform. Stunned me how fast the
bug was solved.



--

Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca

Ajudei? Salvei? Que tal um presentinho?
http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: PHP vs. ASP

2002-01-09 Thread Stephen Abshire

ASP function to print out the date:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctformatdatetime.asp

--- START SAMPLE CODE ---

Function GetCurrentDate
   ' FormatDateTime formats Date in long date.
   GetCurrentDate = FormatDateTime(Date, 1)
End Function

--- END SAMPLE CODE ---


Original Message Follows
From: Mike Eheler [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP] Re: PHP vs. ASP
Date: Wed, 09 Jan 2002 10:57:27 -0800

Well being a former ASP programmer and a current PHP programmer I think
I can help you there.

The key point is ease of use. PHP provides far more functionality than
ASP (try finding a function to print out the date in ASP.. yeah, I
thought so), while at the same time giving you access to low-level areas
of the language so that you can really make it do whatever you want.

Oh yeah, and it's OpenSource. Make it do what you want, and if that
doesn't suit your fancy, then change it :)

ASP costs  -- the server (be it Windows or Unix-based) is gonna cost
ya, any extensions to do more advanced things (such as creating images
on the fly) is gonna cost ya.. cost cost cost.

With ASP I was constantly running into roadblocks because of the way it
works. Let's take form submission.. or beyond that.. uploading FILES.
You can do it the long, hard way (write your own MIME handler and parse
the incoming binary data), or the easy way (shell out $$$ to pay for a
professional activex com object to do the job for you).

And if that wasn't enough. ASP is just plain slower.

Well, that's my 2 cents. There's plenty of more points that could be
said, but I think this should give you some good arguments to start with.

Mike

Jake wrote:

Hello there, I need some help.

I have to do a technical report(about 2200 words) comparing PHP to ASP.  I
have already decided to make PHP the winner becasue it is superior.  But I
am kinda stumped on what areas to compare the two.

If you could help me out in suggesting some possible areas of comparison.
Keeping in mind that I need about the same amount of info on both PHP and
ASP.  Also if you could point me in the right direction by including some
web links that deal with the topic.

Thank You,
Jake





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Newbie question

2002-01-09 Thread Bob Eldred

Hi there,

I'm really really new to both PHP and MySQL, so this is probably going to
turn out to be an easy fix.

The basis is this:  I have a MySQL database with two tables in it.  I'm
trying to update 1 of the fields (aqfl_team) in the first table
(nfl_players) with a value from a field (aqfl_team) from the second table
(temp_aqfl_rosters).

The PHP document looks like this:

html
body
?php

$db = mysql_connect(localhost,root,password);

mysql_select_db(aqfl,$db);

$aqfl_result = mysql_query(SELECT * FROM temp_aqfl_rosters);

echo Updating rosters.;

$myrow = mysql_fetch_array($aqfl_result);

do {

$aqfl_player_first = $myrow[first_name];
$aqfl_player_last = $myrow[last_name];
$aqfl_player_position = $myrow[position];
$aqfl_player_nfl_team = $myrow[nfl_team];
$aqfl_player_aqfl_team = $myrow[aqfl_team];

$nfl_player_id = mysql_query(SELECT player_id FROM nfl_players WHERE
first_name='$aqfl_player_first' AND last_name='$aqfl_player_last' AND
position='$aqfl_player_position' AND nfl_team='$aqfl_player_nfl_team');

$result = mysql_query(UPDATE nfl_players SET
aqfl_team='$aqfl_player_aqfl_team' WHERE player_id='$nfl_player_id');

echo $aqfl_player_first $aqfl_player_last updated ($aqfl_player_position,
$aqfl_player_nfl_team, $aqfl_player_aqfl_team);

} while ($myrow = mysql_fetch_array($aqfl_result));

?

/body
/html


The end result is that I get a screenful of data (every player, NFL team,
and AQFL team is correct) stating that the various players are updated, but
but the field update in nfl_players is not actually done.

I'm sure it's a syntax issue, but I don't know what's the actual problem.

Any help?

Thanks,

Bob



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Newbie question

2002-01-09 Thread Pavel Kharitonov

The problem is here:

$nfl_player_id = mysql_query(SELECT player_id FROM nfl_players WHERE
first_name='$aqfl_player_first' AND last_name='$aqfl_player_last' AND
position='$aqfl_player_position' AND nfl_team='$aqfl_player_nfl_team');

mysql_query does not return the ID, but the handle of the connection. What
you need to do is fetch the results that the query has generated. You can
replace the above code with this one:

//start
$result = mysql_query(SELECT player_id FROM nfl_players WHERE
first_name='$aqfl_player_first' AND last_name='$aqfl_player_last' AND
position='$aqfl_player_position' AND nfl_team='$aqfl_player_nfl_team');

$row_id=mysql_fetch_array($result);

$nfl_player_id = $row_id[0];
//end

This will get you the right ID and should allow to do the update, unless
there are other pbs :)

Sincerely,

Pavel Kharitonov
Project Manager
Intechnic Corporation
http://www.intechnic.com
Phone: (847) 816-1231



-Original Message-
From: Bob Eldred [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 09, 2002 1:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Newbie question


Hi there,

I'm really really new to both PHP and MySQL, so this is probably going to
turn out to be an easy fix.

The basis is this:  I have a MySQL database with two tables in it.  I'm
trying to update 1 of the fields (aqfl_team) in the first table
(nfl_players) with a value from a field (aqfl_team) from the second table
(temp_aqfl_rosters).

The PHP document looks like this:

html
body
?php

$db = mysql_connect(localhost,root,password);

mysql_select_db(aqfl,$db);

$aqfl_result = mysql_query(SELECT * FROM temp_aqfl_rosters);

echo Updating rosters.;

$myrow = mysql_fetch_array($aqfl_result);

do {

$aqfl_player_first = $myrow[first_name];
$aqfl_player_last = $myrow[last_name];
$aqfl_player_position = $myrow[position];
$aqfl_player_nfl_team = $myrow[nfl_team];
$aqfl_player_aqfl_team = $myrow[aqfl_team];

$nfl_player_id = mysql_query(SELECT player_id FROM nfl_players WHERE
first_name='$aqfl_player_first' AND last_name='$aqfl_player_last' AND
position='$aqfl_player_position' AND nfl_team='$aqfl_player_nfl_team');

$result = mysql_query(UPDATE nfl_players SET
aqfl_team='$aqfl_player_aqfl_team' WHERE player_id='$nfl_player_id');

echo $aqfl_player_first $aqfl_player_last updated ($aqfl_player_position,
$aqfl_player_nfl_team, $aqfl_player_aqfl_team);

} while ($myrow = mysql_fetch_array($aqfl_result));

?

/body
/html


The end result is that I get a screenful of data (every player, NFL team,
and AQFL team is correct) stating that the various players are updated, but
but the field update in nfl_players is not actually done.

I'm sure it's a syntax issue, but I don't know what's the actual problem.

Any help?

Thanks,

Bob



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Array Creation

2002-01-09 Thread Jamison Roberts

What I have is a text file that has data in the following format:
username, numbers
The quotation markes can't be helped...the script I use to generate
the file adds them automatically.  (Hummingbird Basic, one of the
worst languages in the history of mankind.)

What I've been trying to do is create an array from the file
with the following format: array (username=numbers)

I have gotten this far:

while (!feof ($fp)) {
$line = fgets($fp, 4096);
  $data = explode(,, str_replace(\, , $line));  //using
str_replace to get rid of quote marks
   //following line to see if data is correct
echo $data[0]. .$data[1].br;
}
fclose($fp);

The data is right, however I can't seem to build an array dynamically.
Also, please let me know if I can do this more efficiently.


Thanks.

NOTE:  Using php 4.0.6, so the function trim($line, \) did not work

**
Jamison R.
Website: http://www.nuitari.com
ICQ: 2375136
MSN Messenger: einstruzende at hotmail.com
**


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: PHP vs. ASP

2002-01-09 Thread Rasmus Lerdorf

 Databases - although PHP 'supports' many databases natively, the support 
 is in the form of 3rd party libraries with PHP wrapper functions. 
 Nothing inherently wrong with that, but the current method dictates that 
 to use oracle you use oci_ functions, for mysql you use mysql_ 
 functions, etc., giving rise to the 'database portability' issue.  Yes, 
 there are db abstraction classes available in PHP, but nothing is native 
 to the language, and that extra layer slows things down (just like ODBC 
 can slow things down in the Windows world).  Don't go throwing 'native 
 db' support around too much without backing it up with solid argument.

Michael, see ext/dbx - the abstraction doesn't get any more native than 
that.

-Rasmus


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Form Problem

2002-01-09 Thread Pavel Kharitonov

I had the same problem happen to me a couple of days ago.
A form that has been working has stopped working all of a sudden - all
fields would be submitting as blank (undefined).

Unfortunately, I was not able figure out what the problem was :-(

I got it down to the line that was causing my form to stop submitting - a
BASE tag. I still do not understand why.

I ended up deleting the entire directory, re-uploading the files and they
started working all of a sudden.

I know it's not much help, just my 2 cents.

Sincerely,

Pavel Kharitonov
Project Manager
Intechnic Corporation
http://www.intechnic.com
Phone: (847) 816-1231



-Original Message-
From: Chris Kwasneski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 09, 2002 1:30 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Form Problem


I'm having a problem with a HTML form.  When it gets submitted, I keep
getting an undefined variable error message.  And a blank page (aside from
a 'Hi' written on it...).  I don't think its a problem with my install of
PHP as other PHP code is running fine, but can't get it to print out this
name.  I'm probably missing something simple, but I just can't figure it
out.

Any help would be appreciated.

the form:

html
  head
  titleMy Form/title
  /head
  body
  form action=test2.php method=GET

  My name is:
  br input type=text name=YourName

  input type=submit name=submit value=Submit /
  /form
  /body
  /html


Test2.php file:
html
head
titleForm test.../title
/head
body
Hi ?php echo $YourName; ?
/body
/html

The url that is getting passed to the file:

http://localhost/test2.php?YourName=Chrissubmit=Submit

The error message I'm getting:


[Wed Jan 09 14:24:47 2002] [error] [client 127.0.0.1] PHP
Warning:  Undefined variable:  YourName in c:\program files\apache
group\apache\htdocs\test2.php on line 10





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re[2]: [PHP] Form Problem

2002-01-09 Thread Intruder

I don't like this line:
input type=submit name=submit value=Submit /
change it:
input type=submit name=submit value=Submit

to my mind it could help ;




PK html
PK   head
PK   titleMy Form/title
PK   /head
PK   body
PK   form action=test2.php method=GET

PK   My name is:
PK   br input type=text name=YourName

PK   input type=submit name=submit value=Submit /
PK   /form
PK   /body
PK   /html



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Array Creation

2002-01-09 Thread Bogdan Stancescu

 while (!feof ($fp)) {
 $line = fgets($fp, 4096);
   $data = explode(,, str_replace(\, , $line));  //using
 str_replace to get rid of quote marks
//following line to see if data is correct
 echo $data[0]. .$data[1].br;

$theArray[$data[0]]=$data[1];


 }
 fclose($fp);

You should make sure you don't accidentally delete some double quotes inside
the strings - maybe
explode(,,substr($line,1,strlen($line)-2));
would be a better option.

Bogdan



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: PHP vs. ASP

2002-01-09 Thread Michael Kimsal

Rasmus Lerdorf wrote:

Databases - although PHP 'supports' many databases natively, the support 
is in the form of 3rd party libraries with PHP wrapper functions. 
Nothing inherently wrong with that, but the current method dictates that 
to use oracle you use oci_ functions, for mysql you use mysql_ 
functions, etc., giving rise to the 'database portability' issue.  Yes, 
there are db abstraction classes available in PHP, but nothing is native 
to the language, and that extra layer slows things down (just like ODBC 
can slow things down in the Windows world).  Don't go throwing 'native 
db' support around too much without backing it up with solid argument.

 
 Michael, see ext/dbx - the abstraction doesn't get any more native than 
 that.
 


I actually was going to mention it, because I know it's being worked on 
- last I read it was 'beta' or something similar, and only supported a 
handful.  My understanding was that even it was still a wrapper system, 
but it's definitely a welcome (huge) step in the right direction, in our 
estimation here.  :)

The site says 'experimetal' - any ideas as to what might change in the 
future to cause backwards compatibility problems?  Or is it too early to 
tell yet?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Form Problem

2002-01-09 Thread Richard Crawford

The presence of the final / in the line makes the page XHTML compliant. 
  It should be left in, and it has no effect whatsoever on the 
functionality of the input tag.  In fact, it should be included in the  
input type=text  tag as well.

I can't find a darn thing wrong with your script.  You might wish to 
double-check your Apache configuration settings; something there might 
be screwy.

Good luck.


Intruder wrote:

 I don't like this line:
 input type=submit name=submit value=Submit /
 change it:
 input type=submit name=submit value=Submit
 
 to my mind it could help ;
 
 
 
 
 PK html
 PK   head
 PK   titleMy Form/title
 PK   /head
 PK   body
 PK   form action=test2.php method=GET
 
 PK   My name is:
 PK   br input type=text name=YourName
 
 PK   input type=submit name=submit value=Submit /
 PK   /form
 PK   /body
 PK   /html
 
 
 



-- 
Sliante,
Richard S. Crawford

mailto:[EMAIL PROTECTED] 
http://www.mossroot.com
AIM:  Buffalo2K   ICQ: 11646404  Yahoo!: rscrawford
MSN:  [EMAIL PROTECTED]

When you have lost the ability to laugh at yourself, you have lost the 
ability to think straight. --Clarence Darrow

Push the button, Max!



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: PHP vs. ASP

2002-01-09 Thread Rasmus Lerdorf

 I actually was going to mention it, because I know it's being worked on 
 - last I read it was 'beta' or something similar, and only supported a 
 handful.  My understanding was that even it was still a wrapper system, 
 but it's definitely a welcome (huge) step in the right direction, in our 
 estimation here.  :)

Every abstraction layer is by definition a wrapper.  

I am sure everyone by now has heard my opinion on db abstraction layers 
though.  As far as I am concerned they are pointless.  It is the wrong 
place to do things.  The right way to do database abstraction is at the 
functional layer.  ie. write a function that implements a certain database 
action your application needs.  get_user_record(), for example.  Then 
write this function for each database your application needs to support.

Anything short of this and you end up with a nearly useless system that is 
only capable of using generic or lowest-common-denominator SQL statements.  
For really simple applications that is ok, I guess, but for anything 
substantial you are going to have to use DB-specific SQL to take advantage 
of each database properly.  See Oracle's DECODE() statement for a blatant 
example of this.

-Rasmus


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Array Creation

2002-01-09 Thread Bogdan Stancescu

Also, make sure you get rid of the space at the beginning of $data[1] - the
space after the comma gets in there, so either use trim() or just trim the
first character programatically ($data[1]=substr($data[1],1)).

Bogdan

Jamison Roberts wrote:

 What I have is a text file that has data in the following format:
 username, numbers
 The quotation markes can't be helped...the script I use to generate
 the file adds them automatically.  (Hummingbird Basic, one of the
 worst languages in the history of mankind.)

 What I've been trying to do is create an array from the file
 with the following format: array (username=numbers)

 I have gotten this far:

 while (!feof ($fp)) {
 $line = fgets($fp, 4096);
   $data = explode(,, str_replace(\, , $line));  //using
 str_replace to get rid of quote marks
//following line to see if data is correct
 echo $data[0]. .$data[1].br;
 }
 fclose($fp);

 The data is right, however I can't seem to build an array dynamically.
 Also, please let me know if I can do this more efficiently.

 Thanks.

 NOTE:  Using php 4.0.6, so the function trim($line, \) did not work

 **
 Jamison R.
 Website: http://www.nuitari.com
 ICQ: 2375136
 MSN Messenger: einstruzende at hotmail.com
 **

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] getcwd()

2002-01-09 Thread Paul Zernik

Hi,

Under PHP 4.0 getcwd() worked fine. Now my provider changes to PHP 4.1.1 and
now it doesn't work any more. What can i do to get the current directory
(url) now?

thx
Paul Zernik



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] counting with dates (help!)

2002-01-09 Thread Peter J. Schoenster

On 7 Feb 2002, at 23:21, Sander Peters wrote:

 Hello,
 
 
 This is my problem:
 
 $today = date(Ymd, mktime(0,0,0, date(m),date(d),date(Y)));
 $last_week = date(Ymd, mktime(0,0,0, date(m),date(d)-7,date(Y)));
 echo ($today - $last_week); The result is a number like 8876
 (20020107-20011231 = 8876) But in date thinking it should be 7!
 
 How can I let php count in real days/month/years in stead of numbers?


Sanders,

I've not prorammed PHP much (Perl), but I looked in the docs and 
could not find anything. I tested your above code and on my 
FreeBSD box with PHP Version 4.0.6 it returned 7.

Peter



Good Perl5/mod_perl/Apache/RDBMS/Unix developer seeking work
call 901-652-2002 or email [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Help me Apache and PHP on WinMe

2002-01-09 Thread J.Vasquez

When I run Apache display this error:



  [wed Jan 09 15:50:18 2002] [warn] pid file c:/Archivos de programa/apache 
group/
  apache/logs/httpd.pid overwritten -- Unclean shutdown of previous run?

Cannot find module IP-MIB: At line 0 in none
Cannot find module IF-MIB: At line 0 in none
Cannot find module TCP-MIB: At line 0 in none
Cannot find module UDP-MIB: At line 0 in none
Cannot find module SNMPv2-MIB: At line 0 in none
Cannot find module SNMPv2-MIB: At line 0 in none
Apache/1.3.22 Win 32 PHP/4.1.0 running...



And display in a window:
---
| Apache provocó a error in PHP_ISSFUNC.DLL |
| Apache should closed|
---

how I do?


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] need help looping through each record with a query - stumped

2002-01-09 Thread Brian Tully

hey folks - 

i'm stumped. been working on what i thought would be a simple script to
cycle through users' records and perform a query. But I can't get the loops
right, it seems like only one or two records get updated.

Using MySQL, we have about 2000 students enrolled. each month they take a
test. if they pass the most recent 3 tests (consecutively) they earn
Certified status and get a few perks.

Somehow the certification status' got messed up. So I'm trying to create a
script that will look through each user's test records to see if they've
passed the last 3 tests, and if so, change their certification status in the
database.

Not very elegant since there are so many records in the database (2000
users), but I don't think i have a choice.

Anyways, I've tried to loop through each user, and for each user loop
through their scores. But the loops aren't working. I'm sure it's something
simple and obvious I'm missing but my brain is fried!

I'd appreciate it if someone could take a look and offer any advice. It's
about 65 lines of code (with comments).

thanks in advance!
brian



?php

include(/home/includes/.connect.inc);

// Select each Username and start a loop of queries for each user

$query = (SELECT Username, Certification FROM users);

$result = mysql_query($query)
or die (Cannot execute query . mysql_error ());

/*
here starts the loop - for each user in the database we look at their test
records and try to establish if they have passed the last 3 tests
consecutively
*/

while (list($Username, $Certification) = mysql_fetch_row($result)) {

$query2 = (SELECT Month, Score FROM scores WHERE Username =
'$Username');

$result2 = mysql_query($query2) or die (Cannot execute query .
mysql_error ());


/*
for each score record the user has, check to see if they've passed the last
3 tests
*/

while (list($Month, $Score) = mysql_fetch_row($result2)) {


/* 
here we initialize a counter which we'll use to tally how many tests the
user has passed over the past 3 months
*/

$tally = 0;

if (($Month == 'January')  ($Score = 75)) {
   
$tally++;
}

if (($Month == 'December')  ($Score = 75)) {
   
$tally++;
}

if (($Month == 'November')  ($Score = 75)) {
   
$tally++;
}

if (($Month == 'October')  ($Score = 75)) {
   
$tally++;
}

}

/*
the concept is that if a user has taken and passed the last 3 tests, they
become certified. so we look at the current month first and go back 3
months, since it may be the beginning of the month and they may not have
taken the current months test yet. Since we increase the counter for each
passed test, if the counter equals 3 or more this means they have passed 3
tests and are thereby certified. So we update their certification status in
the database.
*/


if ($tally = 3) {

$query1 = (UPDATE users SET Certification = 'Y' WHERE Username =
'$Username');
   
$result1 = mysql_query($query1) or die (Cannot update user to
Certified . mysql_error ());
   
}
}

print (Update complete!);

?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP and Images stored in mysql

2002-01-09 Thread Rodrigo Peres

Hi list,

I have some images stored in a blob in mysql. I've made this code to output
them to html, but the problem is if there's no image at a given id the page
tooks a long time to load and display the broken image, there's a way to
avoid this, I mean, there's a way to print a message or another image if
there's none in mysql ???

?
$sql = SELECT Imagem_data,Imagem_type FROM imagens WHERE
CelebID='$celebID';
$query = new Query($conexao);
$query-executa($sql);
$resultado = $query-dados();
mysql_close();

$imagem_banco = $resultado['Imagem_data'];
$type = $resultado['Imagem_type'];
if($imagem_banco != ) {
HEADER(Content-type: $type);
echo($imagem_banco);
}
}
?

Thank's in advance

Rodrigo
-- 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Delete on exit

2002-01-09 Thread Ryan Kelley

I am writing an online store and  have setup sessions to run when a user
enters the site they can shop around and browse without logging in. They
only have to login when the want to checkout. But if a user a) closes the
browser or b)leaves the site without buying anything then i need it to empty
their cart.

Any ideas?

Thanks,

Ryan Kelley



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Delete on exit

2002-01-09 Thread Mehmet Kamil ERISEN

Hi,
You can store all shopping cart activites in a cookie until
it is written to your database. 
When they login, call the cookie and insert the cookie SC
to the database
 

--- Ryan Kelley [EMAIL PROTECTED] wrote:
 I am writing an online store and  have setup sessions to
 run when a user
 enters the site they can shop around and browse without
 logging in. They
 only have to login when the want to checkout. But if a
 user a) closes the
 browser or b)leaves the site without buying anything then
 i need it to empty
 their cart.
 
 Any ideas?
 
 Thanks,
 
 Ryan Kelley
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 


=
Mehmet Erisen
http://www.erisen.com

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] need help looping through each record with a query - stumped

2002-01-09 Thread Mehmet Kamil ERISEN

Hi,
If I am not missing anything, you are not sorting 
SELECT Month, Score 
FROM scores 
WHERE Username = '$Username'

Also, the requirement is not three consecutive test in a
month, so I would not break the loop into months.
once you have it ordered it by the date :

   while (list($Month, $Score) = mysql_fetch_row($result2))
{


/* 
here we initialize a counter which we'll use to tally how
many tests the
user has passed over the past 3 months
*/

$tally = 0;

if ($Score = 75) {
 
$tally++ ;

   }  else {
$tally = 0;
// here you are bringing the tally back to 0 if they missed
one.
}
 
   if ($tally=3) { $certified=1 } ;

This should do it. In this loop, if there are three consc.
over 75 scores, then $certified will equal to 1.  Even
$tally goes back to 0, if the student misses a test after
being certified, $certified will not change.


At the end, instead of using $tally=3 use $certified=='1'


I hope this helps.





I would sort this by date or test_id or whatever.



--- Brian Tully [EMAIL PROTECTED] wrote:
 hey folks - 
 
 i'm stumped. been working on what i thought would be a
 simple script to
 cycle through users' records and perform a query. But I
 can't get the loops
 right, it seems like only one or two records get updated.
 
 Using MySQL, we have about 2000 students enrolled. each
 month they take a
 test. if they pass the most recent 3 tests
 (consecutively) they earn
 Certified status and get a few perks.
 
 Somehow the certification status' got messed up. So I'm
 trying to create a
 script that will look through each user's test records to
 see if they've
 passed the last 3 tests, and if so, change their
 certification status in the
 database.
 
 Not very elegant since there are so many records in the
 database (2000
 users), but I don't think i have a choice.
 
 Anyways, I've tried to loop through each user, and for
 each user loop
 through their scores. But the loops aren't working. I'm
 sure it's something
 simple and obvious I'm missing but my brain is fried!
 
 I'd appreciate it if someone could take a look and offer
 any advice. It's
 about 65 lines of code (with comments).
 
 thanks in advance!
 brian
 
 
 
 ?php
 
 include(/home/includes/.connect.inc);
 
 // Select each Username and start a loop of queries for
 each user
 
 $query = (SELECT Username, Certification FROM users);
 
 $result = mysql_query($query)
 or die (Cannot execute query . mysql_error ());
 
 /*
 here starts the loop - for each user in the database we
 look at their test
 records and try to establish if they have passed the last
 3 tests
 consecutively
 */
 
 while (list($Username, $Certification) =
 mysql_fetch_row($result)) {
 
 $query2 = (SELECT Month, Score FROM scores WHERE
 Username =
 '$Username');
 
 $result2 = mysql_query($query2) or die (Cannot
 execute query .
 mysql_error ());
 
 
 /*
 for each score record the user has, check to see if
 they've passed the last
 3 tests
 */
 
 while (list($Month, $Score) =
 mysql_fetch_row($result2)) {
 
 
 /* 
 here we initialize a counter which we'll use to tally how
 many tests the
 user has passed over the past 3 months
 */
 
 $tally = 0;
 
 if (($Month == 'January')  ($Score = 75)) {

 $tally++;
 }
 
 if (($Month == 'December')  ($Score = 75)) {

 $tally++;
 }
 
 if (($Month == 'November')  ($Score = 75)) {

 $tally++;
 }
 
 if (($Month == 'October')  ($Score = 75)) {

 $tally++;
 }
 
 }
 
 /*
 the concept is that if a user has taken and passed the
 last 3 tests, they
 become certified. so we look at the current month first
 and go back 3
 months, since it may be the beginning of the month and
 they may not have
 taken the current months test yet. Since we increase the
 counter for each
 passed test, if the counter equals 3 or more this means
 they have passed 3
 tests and are thereby certified. So we update their
 certification status in
 the database.
 */
 
 
 if ($tally = 3) {
 
 $query1 = (UPDATE users SET Certification = 'Y'
 WHERE Username =
 '$Username');

 $result1 = mysql_query($query1) or die (Cannot
 update user to
 Certified . mysql_error ());

 }
 }
 
 print (Update complete!);
 
 ?
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 


=
Mehmet Erisen
http://www.erisen.com

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!

[PHP] Party/RSVP App?

2002-01-09 Thread Michael O'Neal

Hi all,

I'm looking for a PHP Party Invite/RSVP app.  I'd like it to be similar to
evite.com.  I'm just checking first to see if something exists before I dig
into it myself.

Thanks,


mto

-- 

Michael O'Neal
Web Producer
-
 M   A   N   G   O
B  O  U  L  D  E  R
-
http://www.thinkmango.com
e- [EMAIL PROTECTED]
p- 303.442.1821
f- 303.938.8507


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Party/RSVP App?

2002-01-09 Thread Michael O'Neal

Hi all,

I'm looking for a PHP Party Invite/RSVP app.  I'd like it to be similar to
evite.com.  I'm just checking first to see if something exists before I dig
into it myself.

Thanks,


mto

-- 

Michael O'Neal
Web Producer
-
 M   A   N   G   O
B  O  U  L  D  E  R
-
http://www.thinkmango.com
e- [EMAIL PROTECTED]
p- 303.442.1821
f- 303.938.8507


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Party/RSVP App?

2002-01-09 Thread Jason Bell

go take a look at some of the script archive pages like
http://www.hotscripts.com

I'm sure someone out there has made this already


- Original Message -
From: Michael O'Neal [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 09, 2002 2:56 PM
Subject: [PHP] Party/RSVP App?


 Hi all,

 I'm looking for a PHP Party Invite/RSVP app.  I'd like it to be similar to
 evite.com.  I'm just checking first to see if something exists before I
dig
 into it myself.

 Thanks,


 mto

 --

 Michael O'Neal
 Web Producer
 -
  M   A   N   G   O
 B  O  U  L  D  E  R
 -
 http://www.thinkmango.com
 e- [EMAIL PROTECTED]
 p- 303.442.1821
 f- 303.938.8507


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP and Images stored in mysql

2002-01-09 Thread Bogdan Stancescu

My way around this is using two fallback stages: for one you test
mysql_num_rows() after performing the query. If that's 0, use a default image
placed in the database beforehand. If that also returns a null mysql_num_rows()
then echo an image (probably the same default) from a known location in the
filesystem.

HTH

Bogdan

Rodrigo Peres wrote:

 Hi list,

 I have some images stored in a blob in mysql. I've made this code to output
 them to html, but the problem is if there's no image at a given id the page
 tooks a long time to load and display the broken image, there's a way to
 avoid this, I mean, there's a way to print a message or another image if
 there's none in mysql ???


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Interesting Problem

2002-01-09 Thread Yoed

Hi... I have an interesting problem I don't know which way to solve. So I'll
shoot it out to you guys and see what you might offer.

I have two databases, say X, and Y:

CREATE TABLE X(
Id int(11) NOT NULL auto_increment,
Dep_Date date,
Return_Date date,
Cat1_Status varchar(100),
Cat2_Status varchar(100),
Cat3_Status varchar(100),
Cat4_Status varchar(100),
PRIMARY KEY (Id));

CREATE TABLE Y(
Id int(11) NOT NULL auto_increment,
Dep_Date date,
Return_Date date,
A_Status varchar(100),
B_Status varchar(100),
C_Status varchar(100),
D_Status varchar(100),
E_Status varchar(100),
PRIMARY KEY (Id));

Now what I am trying to do is get it to display on one page one listing in
Chronoligical order based on the Dep_Date from BOTH of these tables. Trying
something simple like
mysql_query(SELECT Id, Dep_Date, Return_DateFROM X,Y WHERE Dep_Date LIKE
'%$SelectDate%' OR Return_Date LIKE '%$SelectDate%' ORDER BY Dep_Date);
Will give you a ton of errors, and I'm not very fimilar with JOIN and SQL
and how that works. My idea was to create two querys, but the results in
somesort of array, and then order the array by date... I was wondering
though if this is a good efficient way or if you guys have any better
suggestions as to what I should do.

Thanks for your time and help,
Yoed



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Apache and /

2002-01-09 Thread Todd Cary

I forgot the parameter to change in httpd.conf so when the trailing /
is left off, the index.html will be executed.  Anyone know the
parameter?

Many thanks

Todd

--
Todd Cary
Ariste Software
[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] How long can the session ID be?

2002-01-09 Thread Philip Hallstrom

Hi -
How long can the session ID be?  Infinitely long?  It seems to
always be 32 characters on my system, but it looks like it's built from
the PID and the time and some other stuff which can change... so I'm
assuming it can too...

Can I safely assume it won't get larger than say 64 characters?

Thanks!

-philip



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Apache and /

2002-01-09 Thread Eugene Lee

On Wed, Jan 09, 2002 at 03:47:16PM -0800, Todd Cary wrote:
: 
: I forgot the parameter to change in httpd.conf so when the trailing /
: is left off, the index.html will be executed.  Anyone know the
: parameter?

DirectoryIndex index.html index.htm


-- 
Eugene Lee
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] need help looping through each record with a query - stumped

2002-01-09 Thread Martin Towell

could you change this

$query2 = (SELECT Month, Score FROM scores WHERE Username =
'$Username');

to

$query2 = (SELECT count(*) FROM scores WHERE Username = '$Username' and
Score = 75 and Month in ('January', 'December', 'November', 'October'));
$result2 = mysql_query($query2) or die (Cannot execute query .
mysql_error ());
$tally = mysql_fetch_row($result2);

take out the while loop (the one with all the if's in it) and, if I haven't
stuffed up somewhere, all will be okay - (btw, I haven't had experience
using mysql, but I'm assuming that it's sql is compatable with interbase and
oracle)

Hope that helps
Martin

-Original Message-
From: Brian Tully [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 10, 2002 8:59 AM
To: PHP DB; PHP
Subject: [PHP] need help looping through each record with a query -
stumped


hey folks - 

i'm stumped. been working on what i thought would be a simple script to
cycle through users' records and perform a query. But I can't get the loops
right, it seems like only one or two records get updated.

Using MySQL, we have about 2000 students enrolled. each month they take a
test. if they pass the most recent 3 tests (consecutively) they earn
Certified status and get a few perks.

Somehow the certification status' got messed up. So I'm trying to create a
script that will look through each user's test records to see if they've
passed the last 3 tests, and if so, change their certification status in the
database.

Not very elegant since there are so many records in the database (2000
users), but I don't think i have a choice.

Anyways, I've tried to loop through each user, and for each user loop
through their scores. But the loops aren't working. I'm sure it's something
simple and obvious I'm missing but my brain is fried!

I'd appreciate it if someone could take a look and offer any advice. It's
about 65 lines of code (with comments).

thanks in advance!
brian



?php

include(/home/includes/.connect.inc);

// Select each Username and start a loop of queries for each user

$query = (SELECT Username, Certification FROM users);

$result = mysql_query($query)
or die (Cannot execute query . mysql_error ());

/*
here starts the loop - for each user in the database we look at their test
records and try to establish if they have passed the last 3 tests
consecutively
*/

while (list($Username, $Certification) = mysql_fetch_row($result)) {

$query2 = (SELECT Month, Score FROM scores WHERE Username =
'$Username');

$result2 = mysql_query($query2) or die (Cannot execute query .
mysql_error ());


/*
for each score record the user has, check to see if they've passed the last
3 tests
*/

while (list($Month, $Score) = mysql_fetch_row($result2)) {


/* 
here we initialize a counter which we'll use to tally how many tests the
user has passed over the past 3 months
*/

$tally = 0;

if (($Month == 'January')  ($Score = 75)) {
   
$tally++;
}

if (($Month == 'December')  ($Score = 75)) {
   
$tally++;
}

if (($Month == 'November')  ($Score = 75)) {
   
$tally++;
}

if (($Month == 'October')  ($Score = 75)) {
   
$tally++;
}

}

/*
the concept is that if a user has taken and passed the last 3 tests, they
become certified. so we look at the current month first and go back 3
months, since it may be the beginning of the month and they may not have
taken the current months test yet. Since we increase the counter for each
passed test, if the counter equals 3 or more this means they have passed 3
tests and are thereby certified. So we update their certification status in
the database.
*/


if ($tally = 3) {

$query1 = (UPDATE users SET Certification = 'Y' WHERE Username =
'$Username');
   
$result1 = mysql_query($query1) or die (Cannot update user to
Certified . mysql_error ());
   
}
}

print (Update complete!);

?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



RE: [PHP] need help looping through each record with a query - st umped

2002-01-09 Thread Mehmet Kamil ERISEN

If you are querying the Score = 75 how are you ging to
take the Consecutive requirement into the account.
--- Martin Towell [EMAIL PROTECTED] wrote:
 could you change this
 
 $query2 = (SELECT Month, Score FROM scores WHERE
 Username =
 '$Username');
 
 to
 
 $query2 = (SELECT count(*) FROM scores WHERE
 Username = '$Username' and
 Score = 75 and Month in ('January', 'December',
 'November', 'October'));
 $result2 = mysql_query($query2) or die (Cannot
 execute query .
 mysql_error ());
 $tally = mysql_fetch_row($result2);
 
 take out the while loop (the one with all the if's in it)
 and, if I haven't
 stuffed up somewhere, all will be okay - (btw, I haven't
 had experience
 using mysql, but I'm assuming that it's sql is compatable
 with interbase and
 oracle)
 
 Hope that helps
 Martin
 
 -Original Message-
 From: Brian Tully [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 10, 2002 8:59 AM
 To: PHP DB; PHP
 Subject: [PHP] need help looping through each record with
 a query -
 stumped
 
 
 hey folks - 
 
 i'm stumped. been working on what i thought would be a
 simple script to
 cycle through users' records and perform a query. But I
 can't get the loops
 right, it seems like only one or two records get updated.
 
 Using MySQL, we have about 2000 students enrolled. each
 month they take a
 test. if they pass the most recent 3 tests
 (consecutively) they earn
 Certified status and get a few perks.
 
 Somehow the certification status' got messed up. So I'm
 trying to create a
 script that will look through each user's test records to
 see if they've
 passed the last 3 tests, and if so, change their
 certification status in the
 database.
 
 Not very elegant since there are so many records in the
 database (2000
 users), but I don't think i have a choice.
 
 Anyways, I've tried to loop through each user, and for
 each user loop
 through their scores. But the loops aren't working. I'm
 sure it's something
 simple and obvious I'm missing but my brain is fried!
 
 I'd appreciate it if someone could take a look and offer
 any advice. It's
 about 65 lines of code (with comments).
 
 thanks in advance!
 brian
 
 
 
 ?php
 
 include(/home/includes/.connect.inc);
 
 // Select each Username and start a loop of queries for
 each user
 
 $query = (SELECT Username, Certification FROM users);
 
 $result = mysql_query($query)
 or die (Cannot execute query . mysql_error ());
 
 /*
 here starts the loop - for each user in the database we
 look at their test
 records and try to establish if they have passed the last
 3 tests
 consecutively
 */
 
 while (list($Username, $Certification) =
 mysql_fetch_row($result)) {
 
 $query2 = (SELECT Month, Score FROM scores WHERE
 Username =
 '$Username');
 
 $result2 = mysql_query($query2) or die (Cannot
 execute query .
 mysql_error ());
 
 
 /*
 for each score record the user has, check to see if
 they've passed the last
 3 tests
 */
 
 while (list($Month, $Score) =
 mysql_fetch_row($result2)) {
 
 
 /* 
 here we initialize a counter which we'll use to tally how
 many tests the
 user has passed over the past 3 months
 */
 
 $tally = 0;
 
 if (($Month == 'January')  ($Score = 75)) {

 $tally++;
 }
 
 if (($Month == 'December')  ($Score = 75)) {

 $tally++;
 }
 
 if (($Month == 'November')  ($Score = 75)) {

 $tally++;
 }
 
 if (($Month == 'October')  ($Score = 75)) {

 $tally++;
 }
 
 }
 
 /*
 the concept is that if a user has taken and passed the
 last 3 tests, they
 become certified. so we look at the current month first
 and go back 3
 months, since it may be the beginning of the month and
 they may not have
 taken the current months test yet. Since we increase the
 counter for each
 passed test, if the counter equals 3 or more this means
 they have passed 3
 tests and are thereby certified. So we update their
 certification status in
 the database.
 */
 
 
 if ($tally = 3) {
 
 $query1 = (UPDATE users SET Certification = 'Y'
 WHERE Username =
 '$Username');

 $result1 = mysql_query($query1) or die (Cannot
 update user to
 Certified . mysql_error ());

 }
 }
 
 print (Update complete!);
 
 ?
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 


=
Mehmet Erisen
http://www.erisen.com

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
PHP General Mailing List (http://www.php.net/)
To 

RE: [PHP] need help looping through each record with a query - st umped

2002-01-09 Thread Martin Towell

i'm converting Brian's php code into sql - he's looking for scores in Oct,
Nov, Dec and Jan, that's what I'm doing in the sql, and the if's all have
if score = 75 which is what I'm doing in the sql too, Brian is getting a
total $tally++  so am I count(*)...

-Original Message-
From: Mehmet Kamil ERISEN [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 10, 2002 11:10 AM
To: Martin Towell; 'Brian Tully'; PHP DB; PHP
Subject: RE: [PHP] need help looping through each record with a query -
st umped


If you are querying the Score = 75 how are you ging to
take the Consecutive requirement into the account.
--- Martin Towell [EMAIL PROTECTED] wrote:
 could you change this
 
 $query2 = (SELECT Month, Score FROM scores WHERE
 Username =
 '$Username');
 
 to
 
 $query2 = (SELECT count(*) FROM scores WHERE
 Username = '$Username' and
 Score = 75 and Month in ('January', 'December',
 'November', 'October'));
 $result2 = mysql_query($query2) or die (Cannot
 execute query .
 mysql_error ());
 $tally = mysql_fetch_row($result2);
 
 take out the while loop (the one with all the if's in it)
 and, if I haven't
 stuffed up somewhere, all will be okay - (btw, I haven't
 had experience
 using mysql, but I'm assuming that it's sql is compatable
 with interbase and
 oracle)
 
 Hope that helps
 Martin
 
 -Original Message-
 From: Brian Tully [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 10, 2002 8:59 AM
 To: PHP DB; PHP
 Subject: [PHP] need help looping through each record with
 a query -
 stumped
 
 
 hey folks - 
 
 i'm stumped. been working on what i thought would be a
 simple script to
 cycle through users' records and perform a query. But I
 can't get the loops
 right, it seems like only one or two records get updated.
 
 Using MySQL, we have about 2000 students enrolled. each
 month they take a
 test. if they pass the most recent 3 tests
 (consecutively) they earn
 Certified status and get a few perks.
 
 Somehow the certification status' got messed up. So I'm
 trying to create a
 script that will look through each user's test records to
 see if they've
 passed the last 3 tests, and if so, change their
 certification status in the
 database.
 
 Not very elegant since there are so many records in the
 database (2000
 users), but I don't think i have a choice.
 
 Anyways, I've tried to loop through each user, and for
 each user loop
 through their scores. But the loops aren't working. I'm
 sure it's something
 simple and obvious I'm missing but my brain is fried!
 
 I'd appreciate it if someone could take a look and offer
 any advice. It's
 about 65 lines of code (with comments).
 
 thanks in advance!
 brian
 
 
 
 ?php
 
 include(/home/includes/.connect.inc);
 
 // Select each Username and start a loop of queries for
 each user
 
 $query = (SELECT Username, Certification FROM users);
 
 $result = mysql_query($query)
 or die (Cannot execute query . mysql_error ());
 
 /*
 here starts the loop - for each user in the database we
 look at their test
 records and try to establish if they have passed the last
 3 tests
 consecutively
 */
 
 while (list($Username, $Certification) =
 mysql_fetch_row($result)) {
 
 $query2 = (SELECT Month, Score FROM scores WHERE
 Username =
 '$Username');
 
 $result2 = mysql_query($query2) or die (Cannot
 execute query .
 mysql_error ());
 
 
 /*
 for each score record the user has, check to see if
 they've passed the last
 3 tests
 */
 
 while (list($Month, $Score) =
 mysql_fetch_row($result2)) {
 
 
 /* 
 here we initialize a counter which we'll use to tally how
 many tests the
 user has passed over the past 3 months
 */
 
 $tally = 0;
 
 if (($Month == 'January')  ($Score = 75)) {

 $tally++;
 }
 
 if (($Month == 'December')  ($Score = 75)) {

 $tally++;
 }
 
 if (($Month == 'November')  ($Score = 75)) {

 $tally++;
 }
 
 if (($Month == 'October')  ($Score = 75)) {

 $tally++;
 }
 
 }
 
 /*
 the concept is that if a user has taken and passed the
 last 3 tests, they
 become certified. so we look at the current month first
 and go back 3
 months, since it may be the beginning of the month and
 they may not have
 taken the current months test yet. Since we increase the
 counter for each
 passed test, if the counter equals 3 or more this means
 they have passed 3
 tests and are thereby certified. So we update their
 certification status in
 the database.
 */
 
 
 if ($tally = 3) {
 
 $query1 = (UPDATE users SET Certification = 'Y'
 WHERE Username =
 '$Username');

 $result1 = mysql_query($query1) or die (Cannot
 update user to
 Certified . mysql_error ());

 

[PHP] Apache and PHP4 on Win Me

2002-01-09 Thread J.Vasquez

Hi:

When run Apache display this error:

Cannot find module IP-MIB:At line 0 none
Cannot find module IF-MIB:At line 0 none
Cannot find module TCP-MIB:At line 0 none
Cannot find module UDP-MIB:At line 0 none
Cannot find module SNMPv2-MIB:At line 0 none
Cannot find module SNMPv2-SMI:At line 0 none

¿whi?

how I do?


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Interesting Problem

2002-01-09 Thread Bogdan Stancescu

It's obviously more effective to do it in MySQL, but you shouldn't have any real
processing problems even if you don't find an appropriate solution using MySQL
exclusively, because you'd have the two arrays ordered by MySQL, so all you'll
have to do would be something like

$myrow1=mysql_fetch_row($result1);
while ($myrow2=mysql_fetch_row($result2)) {
  while (($myrow1)  ($myrow1[Dep_Date]$myrow2[Dep_Date])) {
$finalrow[]=$myrow1[Dep_Date];
$myrow1=mysql_fetch_row($result1);
  }
  $finalrow[]=$myrow2;
}
while ($myrow1=mysql_fetch_row($result1)) {
  $finalrow[]=$myrow1;
}

This way you only loop the same number of times as the total number of rows
(R1+R2) and perform at most R2 comparisons, which is not bad at all for a
sorting function. :-)

My sggestion if you really need great optimization on this one would be to
address the guys at http://lists.mysql.com (by subscribing to the list). I've
seen answers to problems I thought unsolvable through MySQL, so they'll probably
find a solution for this one too.

Bogdan

Yoed wrote:

 Hi... I have an interesting problem I don't know which way to solve. So I'll
 shoot it out to you guys and see what you might offer.

 I have two databases, say X, and Y:

 CREATE TABLE X(
 Id int(11) NOT NULL auto_increment,
 Dep_Date date,
 Return_Date date,
 Cat1_Status varchar(100),
 Cat2_Status varchar(100),
 Cat3_Status varchar(100),
 Cat4_Status varchar(100),
 PRIMARY KEY (Id));

 CREATE TABLE Y(
 Id int(11) NOT NULL auto_increment,
 Dep_Date date,
 Return_Date date,
 A_Status varchar(100),
 B_Status varchar(100),
 C_Status varchar(100),
 D_Status varchar(100),
 E_Status varchar(100),
 PRIMARY KEY (Id));

 Now what I am trying to do is get it to display on one page one listing in
 Chronoligical order based on the Dep_Date from BOTH of these tables. Trying
 something simple like
 mysql_query(SELECT Id, Dep_Date, Return_DateFROM X,Y WHERE Dep_Date LIKE
 '%$SelectDate%' OR Return_Date LIKE '%$SelectDate%' ORDER BY Dep_Date);
 Will give you a ton of errors, and I'm not very fimilar with JOIN and SQL
 and how that works. My idea was to create two querys, but the results in
 somesort of array, and then order the array by date... I was wondering
 though if this is a good efficient way or if you guys have any better
 suggestions as to what I should do.

 Thanks for your time and help,
 Yoed

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




  1   2   >