OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 10 May 2003 10:12:17 -0000 Issue 2048

php-general-digest-helplists.php.net
Date: Sat May 10 2003 - 05:12:17 CDT


php-general Digest 10 May 2003 10:12:17 -0000 Issue 2048

Topics (messages 147069 through 147102):

Problem with cookies and Windows/2000 Internet Explorer
        147069 by: nathan buck

Re: html mail
        147070 by: Mario Soto

Re: metar decoding
        147071 by: MVCS
        147072 by: Bryan Koschmann - GKT

Clunked encoding???
        147073 by: Brian Dunning

I need a math genius!
        147074 by: Jason Caldwell
        147076 by: Philip Hallstrom
        147085 by: Pablo

Sorry, Chunked not Clunked
        147075 by: Brian Dunning

Re: Picking a phrase out of a web page.
        147077 by: John

Seeing parse errors?
        147078 by: John
        147079 by: Leif K-Brooks

WEB HOSTING
        147080 by: Tim Burgan
        147081 by: Mike Walth
        147087 by: olinux
        147100 by: Frank Keessen

puzzleing problem
        147082 by: Ryan A
        147098 by: Tom Rogers

strlen question?
        147083 by: Jason Caldwell

Re: [PHP-DB] If a query fails?
        147084 by: Miles Thompson

Creating & balancing text columns
        147086 by: Miles Thompson

Re: Displaying progress in php script
        147088 by: GMane

MySQL Query problem
        147089 by: Daniel R. Anderson
        147091 by: Greg Donald

Quick conditional question
        147090 by: James Taylor
        147092 by: Greg Donald
        147093 by: James Taylor
        147095 by: Greg Donald
        147096 by: James Taylor
        147099 by: Guillaume
        147101 by: James Taylor

PHP on Apache2 on WindowsXP
        147094 by: PHP Spooky

PHP on Apache2 on WindowsXP .. More..
        147097 by: PHP Spooky

Error with fopen and foreach...
        147102 by: megadigital

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


I have been racking my head, pounding the internet, doing everything
I can and I cannot seem to find anything that helps me resolve this
issue.

I have a number of sites that I run all using PHP (obviously) and
I've been doing most of my testing using Mozilla.

Just today a co-worker asked me why the site was broken and on
further investigation I found that their system was not storing
_ANY_ cookies from the site.

Its a Windows 2000 system, and I saw the same behavior from IE 5,
IE 5.5, and IE 6.0. It takes and saves cookies from a large
majority of sites, just no the ones using PHP.

I did a test where I even fresh compiled and used vanilla
configuration files both an apache webserver and php 4.3.1. The
server is available at:

http://mana.kontrol-pad.net

and the test script I wrote was test.php (source is available at
http://mana.kontrol-pad.net/test.phps).

I'm at wits end, has anybody ever encountered anything like this
before?

Nathan

attached mail follows:


You can use both, plain and html text on your mails since MIME allows to do that. Is a good advice to include the plain text before the html for some email clients that can't handle MIME on their mails. If some people don't want to read the html version of the mail message no problem, exists the plain version. If some people can't use MIME, the plain version are at the beggining of the messages. Its good to include a warning like "If you are reading this, is because your email client does not support MIME content. You might see strange format in the message..." or something similar between the headers and the first boundary of the message, If sended both types.

Greetings.

Mario Soto
mario_samigo.net.gt
-.-.-.-

----- Original Message -----
From: "Pierrick LE GALL" <pierrickz0rglub.com>
To: "paul marinas" <paulmsgi.rdscv.ro>
Cc: <php-generallists.php.net>
Sent: Wednesday, May 07, 2003 3:53 PM
Subject: Re: [PHP] html mail

> paul marinas <paulmsgi.rdscv.ro> writes:
>
> > How can i send with php a mail in html format.
>
> The best advice I can give you is to use plain text for mail. Using html
> is generally a very bad idea... Think about problems of accessibility
> for some people, voice synthetiser for html mail are a lot less
> efficient than for plain text mails.
>
> Furthermore, HTML can contain virus and some smart enough people disable
> html mail reading. Plain text mail are secure.
>
> Hope you'll prefer plain text mail.
>
> --
> Pierrick LE GALL | http://www.z0rglub.com
> <pierrickz0rglub.com> | http://www.phpwebgallery.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Bryan,

Even though I've barely managed to distinguish my arse from a hole in the
ground php-wise, I came to this group for metar-related problems as well.
What I've ended up doing is using NOAA's decoded metar for my local
monitoring station, reading that text file into an array, then echoing
whichever line of that array i need, and not using the ones I don't.

what i've come up with:

<?php

$weather = file
('http://205.156.51.200/pub/data/observations/metar/decoded/KLRU.TXT');

echo '<b>Current conditions for Anytown, USA</b><br>';
echo $weather[1] . '<br>';
echo $weather[2] . '<br>';
echo $weather[3] . '<br>';
echo $weather[4] . '<br>';
echo $weather[5] . '<br>';

?>

etc...

"Bryan Koschmann - Gkt" <gktnewsgktech.net> wrote in message
news:Pine.LNX.4.30.0305091222360.1215-100000penguin.gktech.net...
> Hi,
>
> I was wondering, does anyone here have any experience decoding metar
> output? I know ther eis PHP weather, but that is far too much for what I
> want (plus i cant get it working anyway).
>
> I just want to get simple values that I can do what I want with.
>
> If it helps, this is what the output looks like:
>
> 2003/05/09 17:53
> KSFF 091753Z 06008G18KT 10SM SCT090 SCT200 16/01 A3000 RMK AO2 SLP158
> T01560011 10156 20044 50002
>
> The second line is always on one line. I know I can break it up using
> explode, but then I have to get things like this;
>
> 091753Z I need the 09 and the 1753 separated and do not need the Z
> 10SM I need just the 10
> SCT090 I need SCT and 090 separated
> SCT200 I need SCT and 200 separated
>
> There are of course others, but that would at least get me started.
>
> I'm sure it's just a matter of regular expressions, but my brain is having
> trouble grasping those ideas.
>
> If you have any ideas I'd be happy to hear them!
>
> Thanks,
>
> Bryan
>

attached mail follows:


I was just reading the reply from Steve M when I stumbled across this
page in my 20-billionth google search:

http://woody.cowpi.com/phpscripts.html

the getwx script works really well, and gives a very simple output that
can also be easily modified. His code is pretty well commented as well.

Thanks Steve for that input, while I found a script I needed your
information will still be helpful to.

Thanks,

        Bryan

On Fri, 9 May 2003, MVCS wrote:

>
> Bryan,
>
> Even though I've barely managed to distinguish my arse from a hole in the
> ground php-wise, I came to this group for metar-related problems as well.
> What I've ended up doing is using NOAA's decoded metar for my local
> monitoring station, reading that text file into an array, then echoing
> whichever line of that array i need, and not using the ones I don't.
>
> what i've come up with:
>
> <?php
>
> $weather = file
> ('http://205.156.51.200/pub/data/observations/metar/decoded/KLRU.TXT');
>
> echo '<b>Current conditions for Anytown, USA</b><br>';
> echo $weather[1] . '<br>';
> echo $weather[2] . '<br>';
> echo $weather[3] . '<br>';
> echo $weather[4] . '<br>';
> echo $weather[5] . '<br>';
>
> ?>
>

attached mail follows:


Bear with me, I know nothing about PHP, but I am trying to understand a
problem that my programmer is reporting.

He is making a page with an expiring download link, and reports the
following:

"It looks like "clunked" transfer-encoding method used by PHP is
causing this problem. All other IE versions seem to handle it
gracefully, but on Mac OS9 it results in downloaded file inheriting the
name of the php script file handling the request, rather than the value
specified in the http header."

Is there a solution for this? Thanks,

- Brian

attached mail follows:


Hi

I need to divide, subtract and add *very* large unsigned integer numbers --
no floating point numbers. In PHP I'm limited to an integer no larger than:
2,147,483,647 ...

How is it possible to calculate much, much larger numbers?

For example, say I want to add the following number:

(7827363524473290039928827730299288277102938474655367299188272630 +
 7829817981291982837938719793747646199192739190198791238479832)

---

I'm ok at math, but not too skilled in it -- so, if the above can be
calculated using Floating Numbers - great! -- however, if possible, I'd like
to stick to unsigned integers.

Thanks,
Jason

attached mail follows:


might find something in here...

http://www.php.net/manual/en/ref.bc.php
http://www.php.net/manual/en/ref.gmp.php

On Fri, 9 May 2003, Jason Caldwell wrote:

> Hi
>
> I need to divide, subtract and add *very* large unsigned integer numbers --
> no floating point numbers. In PHP I'm limited to an integer no larger than:
> 2,147,483,647 ...
>
> How is it possible to calculate much, much larger numbers?
>
> For example, say I want to add the following number:
>
> (7827363524473290039928827730299288277102938474655367299188272630 +
> 7829817981291982837938719793747646199192739190198791238479832)
>
> ---
>
> I'm ok at math, but not too skilled in it -- so, if the above can be
> calculated using Floating Numbers - great! -- however, if possible, I'd like
> to stick to unsigned integers.
>
> Thanks,
> Jason
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


On 05/09/2003 5:46 PM, Jason Caldwell (jasonthinkingman.org) wrote:

> Hi
>
> I need to divide, subtract and add *very* large unsigned integer numbers --
> no floating point numbers. In PHP I'm limited to an integer no larger than:
> 2,147,483,647 ...
>
> How is it possible to calculate much, much larger numbers?
>
> For example, say I want to add the following number:
>
> (7827363524473290039928827730299288277102938474655367299188272630 +
> 7829817981291982837938719793747646199192739190198791238479832)

Do you require a PHP-only solution? Or do you just want the result? If the
latter, and you have access to a *nix box with dc you can perform the
calculation:

# dc
7827363524473290039928827730299288277102938474655367299188272630
7829817981291982837938719793747646199192739190198791238479832
+
p
7835193342454582022766766450093035923302131213845566090426752462

Pablo

attached mail follows:


Like I said, I don't know PHP. :) :)

- Brian

attached mail follows:


I use regular expressions a lot to do this. You first want to match 'Price'
in either upper or lower case, then any number of any characters to allow
for a colon or spaces or 'each' or some other qualifier until you find a
dollar sign, then one or more digits, and optionally a decimal point
followed by two digits. Finally, you might want to capture the rest of the
line to check for another price in the same line. This assumes you would
have a leading zero for a sub-dollar price. I think the following will do
this, and I will build the regular expression as I go:

This is what the end expression will be:

$pe = '/Price.*\$(\d+(\.\d\d)?)(.*)/i'; // PERL style regular expression to
find price information

Building logically:

$pe = '/'; // opening delimiter for price expression
$pe .= 'Price'; // match 'Price literally - later allow for case
$pe .= '.*'; // match any number of any characters until a $
$pe .= '\$'; // escape a dollar sign to avoid special meaning
$pe .= '('; // begin subpattern which will be captured
$pe .= '\d+'; // match one or more digit
$pe .= '('; // begin subpattern for optional decimal point and digits
$pe .= '\.'; // escape decimal point to avoid special meaning
$pe .= '\d\d'; // match two digits
$pe .= ')?'; // close subpattern and indicate it is optional
$pe .= ')'; // close pattern which is captured
$pe .= '(.*)'; // capture the rest of the line
$pe .= '/'; // tailing delimiter
$pe .= 'i'; // trailing option indicating ignore case

$yourarryelement = 'get yours now Price: each $4.56' ha-ha; // test string
$price_found = preg_match($pe, $yourarrayelement, $match); // true if price
found

If a price is found, $match[1] will contain the price without the dollar
sign, $match[2] will contain the cents if they exist, and $match[3] will
contain any remaining characters after the match, "ha-ha" in this case, but
in some cases there could be additional prices.

attached mail follows:


Can I see parse errors? For example,

a = 5;

should generate a parse error, but all that happens is my php file quits
processing at that point, and no error is returned to the html page (which
also quits). The default for my server site is no display_errors, but I
have successfully overridden that by placing,

phpinfo();
ini_set("display_errors", "1");
ini_set("error_reporting", "2047");
phpinfo();

at the very beginning of my file and verifying the changes were accepted. I
am a courtesy user on this server, and it would be difficult for me to
request php.ini changes. Thanks!

attached mail follows:


The problem is that PHP never runs the line changing error_reporting (or
any other line) if there's a parse error. You need to change it
somewhere else, a .htaccess file for instance.

news.php.net wrote:

>Can I see parse errors? For example,
>
>a = 5;
>
>should generate a parse error, but all that happens is my php file quits
>processing at that point, and no error is returned to the html page (which
>also quits). The default for my server site is no display_errors, but I
>have successfully overridden that by placing,
>
>phpinfo();
>ini_set("display_errors", "1");
>ini_set("error_reporting", "2047");
>phpinfo();
>
>at the very beginning of my file and verifying the changes were accepted. I
>am a courtesy user on this server, and it would be difficult for me to
>request php.ini changes. Thanks!
>
>
>
>
>
>

--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.

attached mail follows:


Hello,

I'm looking for Web Hosting Recommendations.

I'm desperately looking for a PHP host that will allow unlimited domain
pointers (domains that point to a folder in the root directory) to a single
shared account.

Thanks
Tim

attached mail follows:


Tim:

My name is Mike Walth and I might be able to help you out. I own a web
hosting company running muleiple Sun Ultra Enterprise servers. If you can
send me some more information about what you need done / approximate number
of pointers, etc. I will be happy to see what I can do for you.

I look forward to working with you.
Mike Walth
mike.walthcinofusion.com

-----Original Message-----
From: Tim Burgan [mailto:burganiprimus.com.au]
Sent: Friday, May 09, 2003 5:20 PM
To: PHP Lists
Subject: [PHP] WEB HOSTING

Hello,

I'm looking for Web Hosting Recommendations.

I'm desperately looking for a PHP host that will allow unlimited domain
pointers (domains that point to a folder in the root directory) to a single
shared account.

Thanks
Tim

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

attached mail follows:


I've had very good experience with
www.websitesource.com. I think extra domain pointers
will cost a couple bucks a month, but the prices are
very good. the control panel is killer, best i've
seen.

olinux

--- Tim Burgan <burganiprimus.com.au> wrote:
> Hello,
>
> I'm looking for Web Hosting Recommendations.
>
> I'm desperately looking for a PHP host that will
> allow unlimited domain
> pointers (domains that point to a folder in the root
> directory) to a single
> shared account.
>
> Thanks
> Tim
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

attached mail follows:


Hi Tim,

Try http://www.3shost.com.

Regards,

Frank
----- Original Message -----
From: "Tim Burgan" <burganiprimus.com.au>
To: "PHP Lists" <php-generallists.php.net>
Sent: Saturday, May 10, 2003 2:20 AM
Subject: [PHP] WEB HOSTING

> Hello,
>
> I'm looking for Web Hosting Recommendations.
>
> I'm desperately looking for a PHP host that will allow unlimited domain
> pointers (domains that point to a folder in the root directory) to a
single
> shared account.
>
> Thanks
> Tim
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Hi guys,
Have a puzzleing problem...see if you can help me out.

I visited a site called "hostfilter.com" as I am making a simular site but
am confused by one of their functions in the search page....

their results page is pretty straight forward except for one thing...
normally I would execute an sql something like this for that result:

select * from sometable where price<=5 and platform=unix and space=10

then format the resultset into a nice table so it gives me:

$package $pdetail1 $pdetail2 $pdetail3 $pdetail4 etc
$company-For-The-Above-Package

BUT how is he getting:
$package $pdetail1 $pdetail2 $pdetail3 $pdetail4 etc
$package2 $pdetail1 $pdetail2 $pdetail3 $pdetail4 etc
$package3 $pdetail1 $pdetail2 $pdetail3 $pdetail4 etc
$company-For-The-Above-Package

whenever i try my sql i keep getting the $company-For-The-Above-Package
appearing after every line instaed of once the way its in hostfilter.com's
result...

Am wondering if he is using some special sql or is it an ASP feature and
more importantly how do i do it in PHP?
Any ideas?

Please reply.

Thanks,
-Ryan

attached mail follows:


Hi,

Saturday, May 10, 2003, 10:36:36 AM, you wrote:
RA> Hi guys,
RA> Have a puzzleing problem...see if you can help me out.

RA> I visited a site called "hostfilter.com" as I am making a simular site but
RA> am confused by one of their functions in the search page....

RA> their results page is pretty straight forward except for one thing...
RA> normally I would execute an sql something like this for that result:

RA> select * from sometable where price<=5 and platform=unix and space=10

RA> then format the resultset into a nice table so it gives me:

RA> $package $pdetail1 $pdetail2 $pdetail3 $pdetail4 etc
RA> $company-For-The-Above-Package

RA> BUT how is he getting:
RA> $package $pdetail1 $pdetail2 $pdetail3 $pdetail4 etc
RA> $package2 $pdetail1 $pdetail2 $pdetail3 $pdetail4 etc
RA> $package3 $pdetail1 $pdetail2 $pdetail3 $pdetail4 etc
RA> $company-For-The-Above-Package

RA> whenever i try my sql i keep getting the $company-For-The-Above-Package
RA> appearing after every line instaed of once the way its in hostfilter.com's
RA> result...

RA> Am wondering if he is using some special sql or is it an ASP feature and
RA> more importantly how do i do it in PHP?
RA> Any ideas?

RA> Please reply.

RA> Thanks,
RA> -Ryan

Just do a comparison on $company-For-The-Above-Package and when it
changes output the old one and carry on.

$company-For-The-Above-Package = '';
while(get db reults){
    if(empty($company-For-The-Above-Package)){
        $company-For-The-Above-Package = company;
    }elseif($company-For-The-Above-Package != $company)
        output $company-For-The-Above-Package
        $company-For-The-Above-Package = $company;
    }
    output row info
}

--
regards,
Tom

attached mail follows:


Does strlen() count the string each time it's called or is the string length
stored in the string, and this method just pulls the count from that
location?

Thanks,
Jason

attached mail follows:


Chris,

Takes guts to ask a question like this.

Go directly to the MySQL portion of the most excellent PHP manual and read
the section on mysql_affected_rows() and mysql_num_rows() and you'll ..

a) know when updates/inserts succeeded
b) know how to check for success on the return of data from a SELECT

Cheers - Miles Thompson

At 07:45 PM 5/9/2003 -0400, you wrote:
>Hi there everyone,
>
>Probably something so simple i'll collapse with embarressment, just like
>with my spelling :-) But a quick question, when you perform an update or
>insert etc .... operation on a MySQL Database, how do you find out if it
>was successful or failed, so you can display the correct
>output? Currently if I add to a DB, for example, it goes to a page saying
>it updated successfully but without any error trapping, so even if it
>DIDN'T do it successfully it would still go to the next page.
>
>Thanks for your help :-)
>
>Chris

attached mail follows:


We're just about at the end of the development cycle for a news site,
Articles are stored in a database, fetched through a PHP script and
displayed through a Flash movie. A small percentage of customers prefer a
printed version. For how we got this far, see note(1).

Flash absolutely sucks at printing. So we're taking an alternate approach,
using a small, chromeless browser window with selection & right click
turned off, insofar as this is possible. When the window loads JavaScript
is used to invoke the print dialog. The purpose of all this is to mitigate
a "pass around without paying for it" problem.

Here's the challenge - does anyone know how to balance the printed columns?

Presently I get the length of the article, roughly divide it in two, search
for a space and decide that's where the column break will be. Each column
is then dumped into a table cell. As long as the writing and paragraph
length is reasonably consistent, the results are remarkably good - maybe a
2~4 line discrepancy.

The problem is that if the story breaks across a page, you have to read
the first column, go to the next page and read to the end of that column,
then turn back to the previous page and read down the second column to the
end of the story. Not exactly intuitive.

Now the output device is a browser, and no matter what formatting
instruction I've issued, the user can over-ride them. I've thought of
getting very particular - determining a line count for a "typical" page,
maintaining a line counter, creating an array of lines, formatting each
line for length before placing it in the array, and then divvying up the
array between the column-lines available or remaining on a given page, and
allocating the remainder on the following page. (Sure reminds me of complex
FoxPro reports about 13 yr ago!)

The "page" of course doesn't exist, because output is going to the browser,
which determines what it's page is.

Yes, what we're attempting is a crude, auto-running, Adobe Pagemaker-like
operation in PHP.

Is there a better way? The other option is to let it run in all it's
bug-ugliness, running the copy full width across the page as we did when
typing out term papers, essays and the like when a correcting Selectric was
the hottest thing going.

Regards - Miles Thompson

(1) In case you are wondering, we've tried password protecting the site and
using straight HTML, password protecting and auto-downloading .pdf files,
and direct mailing of .pdf files to subscribers.

The first resulted in sharing of passwords - we're going to start limiting
the number of logins each week.

The second we coped with by allowing a user to login once, then setting a
cookie on the browser, storing its value in the database and setting a
"logged in" flag. If a login from another browser, even on the same
machine, was attempted, it would fail. This was not a really popular
solution, and the .pdf could be forwarded to a "friends of the subscriber"
list. There were also download problems with IE 5.5.

The third is most straightforward, but relies entirely on the honour system
and there is a significant level of "pass around" of the .pdf's. /mt

attached mail follows:


<SLangerspirit21.de> wrote in message
news:OF1EF42929.92A0A737-ONC1256D20.0026C339-41256D20.002C6DF8spirit21.de..

attached mail follows:


When I try:

mysql_query("SELECT * FROM table WHERE something = '{$constraint}'");

(also tried without {}s)

It fails, while when I try:

mysql_query("SELECT * FROM table WHERE something = 'constraint'");

For all those who asked I /did/ echo out the string to show that it's
exactly the same thing. The same query that works when typed in but not
when I try any string concatonation (i.e. $query . $constraint . '\'')or
auto fill (using the variable in the string and letting it expand).

So output is the same thing as a typed in string. Can anybody suggest a
possible fix?

-Dan

attached mail follows:


> When I try:
>
> mysql_query("SELECT * FROM table WHERE something = '{$constraint}'");
>
> (also tried without {}s)
>
> It fails, while when I try:
>
> mysql_query("SELECT * FROM table WHERE something = 'constraint'");
>
> For all those who asked I /did/ echo out the string to show that it's
> exactly the same thing. The same query that works when typed in but not
> when I try any string concatonation (i.e. $query . $constraint . '\'')or
> auto fill (using the variable in the string and letting it expand).
>
> So output is the same thing as a typed in string. Can anybody suggest a
> possible fix?

If you code your query with die() so you can see any sql errors:

mysql_query("SELECT * FROM table WHERE something = 'constraint'") or die
(mysql_error());

--
Greg Donald
http://destiney.com/

attached mail follows:


How can I shorten this syntax:

If($row==1||$row==9||$row==13||$row==20) blah

Looking for something like

If($row==(1||9||13||20))

But, that doesn't work. Thanks

attached mail follows:


> How can I shorten this syntax:
>
> If($row==1||$row==9||$row==13||$row==20) blah

switch($row){
  case 1:
  case 9:
  case 13:
  case 20
  // blah
  break;
}

--
Greg Donald
http://destiney.com/

attached mail follows:


I *suppose* I could use a switch, but I wanted a way to shorten the
code, but span it across numerous lines :)

-----Original Message-----
From: Greg Donald [mailto:destineydestiney.com]
Sent: Friday, May 09, 2003 11:00 PM
To: James Taylor
Cc: php-generallists.php.net
Subject: Re: [PHP] Quick conditional question

> How can I shorten this syntax:
>
> If($row==1||$row==9||$row==13||$row==20) blah

switch($row){
  case 1:
  case 9:
  case 13:
  case 20
  // blah
  break;
}

--
Greg Donald
http://destiney.com/

attached mail follows:


> I *suppose* I could use a switch, but I wanted a way to shorten the
> code, but span it across numerous lines :)

Maybe toss all the numbers in an array and then search it with in_array() ?

--
Greg Donald
http://destiney.com/

attached mail follows:


Oops, should read "not span it across numerous lines"

-----Original Message-----
From: James Taylor [mailto:jtxhatesville.com]
Sent: Friday, May 09, 2003 11:03 PM
To: php-generallists.php.net
Subject: RE: [PHP] Quick conditional question

I *suppose* I could use a switch, but I wanted a way to shorten the
code, but span it across numerous lines :)

-----Original Message-----
From: Greg Donald [mailto:destineydestiney.com]
Sent: Friday, May 09, 2003 11:00 PM
To: James Taylor
Cc: php-generallists.php.net
Subject: Re: [PHP] Quick conditional question

> How can I shorten this syntax:
>
> If($row==1||$row==9||$row==13||$row==20) blah

switch($row){
  case 1:
  case 9:
  case 13:
  case 20
  // blah
  break;
}

--
Greg Donald
http://destiney.com/

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

attached mail follows:


You can try this

$array = array(1, 9, 13, 20);
if (in_array($row, $array)) blah

Guillaume

James Taylor a écrit:
> How can I shorten this syntax:
>
> If($row==1||$row==9||$row==13||$row==20) blah
>
> Looking for something like
>
> If($row==(1||9||13||20))
>
> But, that doesn't work. Thanks
>
>

attached mail follows:


Yeah, I ended up going with if(in_array($row,array(1,9,13,20)).

Thanks for the idea guys

-----Original Message-----
From: Guillaume [mailto:g.jullienfree.fr]
Sent: Friday, May 09, 2003 11:39 PM
To: php-generallists.php.net
Subject: [PHP] Re: Quick conditional question

You can try this

$array = array(1, 9, 13, 20);
if (in_array($row, $array)) blah

Guillaume

James Taylor a écrit:
> How can I shorten this syntax:
>
> If($row==1||$row==9||$row==13||$row==20) blah
>
> Looking for something like
>
> If($row==(1||9||13||20))
>
> But, that doesn't work. Thanks
>
>

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

attached mail follows:


Glory & Supreme Power

I was running Apache 1.3 earlier on my WindowsXP and running PHP
perfectly on it. Today I upgraded to Apache2 ... the latest on
Apache.Org
The Apache service is running fine.. but when I add my PHP Code in
Apache's httpd.conf .. it doesn't Start anymore.. says Operation Failed.
I'm adding the following :

           LoadModule php4_module c:/php/sapi/php4apache.dll
           AddModule mod_php4.c
           AddType application/x-httpd-php .php .php3 .php4

What should I change? Where is the problem?

Thanks,
PHPSpooky

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Every man has a right to fulfill his own Will without
being afraid that it may interfere with that of others;
for if he is in his proper path, it is the fault of
others if they interfere with him.
Do what thy wilt shall be the whole of the Law!
Love is the Law, Love under Will"
                - Aleister Crowley, "Magick without Tears"
 
Rahul S. Johari
Shining Star Productions
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

attached mail follows:


Glory!

I checked out and found that I had to load another DLL then the one I
was using.. and this is what I had to add in httpd.conf :

LoadModule php4_module "c:/php/sapi/php4apache2.dll"
AddType application/x-httpd-php .php .php3 .php4

Instead of this :

           LoadModule php4_module c:/php/sapi/php4apache.dll
           AddModule mod_php4.c
           AddType application/x-httpd-php .php .php3 .php4

I did that.. even then I get the same error. Apache2 just wont start
once I have added the php module in httpd.conf, and it works fine when I
delete these lines from it.
And yes the paths are absolutely correct.. the files exist in
appropriate places.. and nothing is missing.
So what is the Problem?

PHPSpooky

-----Original Message-----
From: PHP Spooky [mailto:phpspookymjimm.com]
Sent: Saturday, May 10, 2003 11:42 AM
To: php-generallists.php.net
Subject: [PHP] PHP on Apache2 on WindowsXP

Glory & Supreme Power

I was running Apache 1.3 earlier on my WindowsXP and running PHP
perfectly on it. Today I upgraded to Apache2 ... the latest on
Apache.Org
The Apache service is running fine.. but when I add my PHP Code in
Apache's httpd.conf .. it doesn't Start anymore.. says Operation Failed.
I'm adding the following :

What should I change? Where is the problem?

Thanks,
PHPSpooky

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Every man has a right to fulfill his own Will without
being afraid that it may interfere with that of others;
for if he is in his proper path, it is the fault of
others if they interfere with him.
Do what thy wilt shall be the whole of the Law!
Love is the Law, Love under Will"
                - Aleister Crowley, "Magick without Tears"
 
Rahul S. Johari
Shining Star Productions
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

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

attached mail follows:


Hello, i am trying to create a program to managem my site
mailing list... As i don't want to use mysql, i am trying to
create a 0-length file with user e-mail just to prevent from
sending mail twice...
But for any reason fopen is not working in my script... it
justs write the last file to the disk...
This is the test source code:

//$email2 is an array with e-mail adresses

$l = 0;

foreach($email2 as $value){

echo "VALUE: $value<br>";

$cont = fopen("$value","a+");
$close = fclose($cont);
$l++;
};

As you can see, script get an e-mail adress and tries to
create an file called $email as it doesn't exists yet... But
this function is creating just the last e-mail file...
Anyone could help me please?

 
---
UOL, o melhor da Internet
http://www.uol.com.br/