php-general Digest 2 May 2002 15:50:42 -0000 Issue 1321

Topics (messages 95640 through 95703):

Re: getting a function name of the calling function
        95640 by: CC Zona
        95642 by: Philip Olson
        95690 by: Joshua E Minnie

Re: file() and macintosh line break
        95641 by: eat pasta type fasta
        95643 by: Philip Olson
        95645 by: Justin French

Columns not displaying as they should
        95644 by: Jennifer Downey
        95646 by: Richard Archer

Re: PHP Editors
        95647 by: José León Serna
        95648 by: Marius Ursache

How do I Install PHP on Apache 2, on win32
        95649 by: Philip Newman
        95686 by: Kirk Babb
        95695 by: vins

Re: variables over 2 pages w/ a table.
        95650 by: Marius Ursache

Re: php/.htaccess/.htpasswd
        95651 by: Mika Tuupola

Hashes in strings
        95652 by: Ferry van Steen
        95653 by: Justin French
        95654 by: Dan Hardiker
        95655 by: Alexander Weber
        95656 by: Ford, Mike               [LSS]
        95660 by: Ferry van Steen
        95687 by: Steve Bradwell
        95701 by: Markus Mirsberger
        95703 by: Dan Hardiker

CVS handled PHP projects
        95657 by: Dan Hardiker
        95661 by: Richard Archer
        95672 by: Dan Hardiker

Stupid question
        95658 by: Liam MacKenzie
        95659 by: Henrik Hansen
        95664 by: Craig Vincent
        95665 by: Dan Hardiker

Opinions Wanted
        95662 by: John Fishworld
        95663 by: Craig Vincent
        95666 by: Dan Hardiker
        95675 by: 1LT John W. Holmes

Email-attachment not working
        95667 by: Swati Patil
        95676 by: 1LT John W. Holmes

Test if a daemon is running...
        95668 by: Gilles Nedostoupof
        95670 by: Dan Hardiker
        95673 by: Gilles Nedostoupof
        95674 by: Dan Hardiker

Upload File
        95669 by: Kalpin Erlangga Silaen
        95671 by: Justin French
        95677 by: 1LT John W. Holmes

Re: Any ideas on content management system for Apache+PHP+MySQL
        95678 by: Jay Blanchard

PRIMARY KEY vs. INDEX
        95679 by: Christoph Starkmann
        95680 by: 1LT John W. Holmes
        95681 by: Miles Thompson
        95682 by: Dan Hardiker

Re: why is better?
        95683 by: Steve Bradwell
        95691 by: Hugh Bothwell
        95700 by: Julio Nobrega Trabalhando

Re: Retrieving name of error_log file
        95684 by: Neil Freeman

Get Pagetitle with PHP
        95685 by: Ivo Neuhauser
        95688 by: Justin French
        95699 by: Pushkar Pradhan

Header Information for Formatting?
        95689 by: Jay Blanchard

Re: bumping up hour by one
        95692 by: Hugh Bothwell

page reloading
        95693 by: Donna Robinson
        95696 by: Dan Hardiker
        95702 by: Donna Robinson

Multiple mails to be sent from checkbox selection
        95694 by: Kevin Meredith
        95697 by: Dan Hardiker
        95698 by: 1LT John W. Holmes

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Joshua E Minnie) wrote:

> Does anybody know of any constants or predefined functions that will
> retrieve the calling functions name?  For example:
> 
> <?
> function new_func($somedata) {
>   echo "I am function ".get_func_name();
> }
> ?>

What would be the point of this?  How could you call the function to get 
the info without already having the info in the first place?  If calling 
with a variable ("$foo();"), then you have the variable.  If the call is 
hardcoded ("new_func();") then of course you know the name there too.  
Perhaps if you explained what you're trying to accomplish...

-- 
CC
--- End Message ---
--- Begin Message ---
> > Does anybody know of any constants or predefined functions that will
> > retrieve the calling functions name?  For example:
> > 
> > <?
> > function new_func($somedata) {

      echo "I am function " . __FUNCTION__;

> >   echo "I am function ".get_func_name();
> > }
> > ?>

__FUNCTION__ will exist (exists) in PHP 4.3.0.  This feature
request can be seen here:

  http://bugs.php.net/bug.php?id=8576
  http://bugs.php.net/bug.php?id=11393
  http://cvs.php.net/co.php/php4/NEWS

__CLASS__ will also come into being, to go along with their 
older siblings __LINE__ and __FILE__.

These are special PHP core reserved/predefined constants.

Regards,
Philip Olson


p.s. Controversy surrounds these magic constants,
     are they *really* constants?  Inquiring minds 
     want to know. :)

     http://www.php.net/constants


--- End Message ---
--- Begin Message ---
What I am trying to do is create an error message within in a string that
whenever each function fails it echos this particular string out with it's
pertinent information.

i.e.
<?
$error_string = "Warning: unable to complete query in ".__FUNCTION__."name
in ".__FILE__;

function some_funct($var) {
  global $error_string;
  //doing something
  //error detected
  echo $error_string;
}
?>

Does this sounds feasible or is there another way to generate a dynamic
error message without giving the user to much information about the error if
it occurs?

-josh

"Cc Zona" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> In article <[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED] (Joshua E Minnie) wrote:
>
> > Does anybody know of any constants or predefined functions that will
> > retrieve the calling functions name?  For example:
> >
> > <?
> > function new_func($somedata) {
> >   echo "I am function ".get_func_name();
> > }
> > ?>
>
> What would be the point of this?  How could you call the function to get
> the info without already having the info in the first place?  If calling
> with a variable ("$foo();"), then you have the variable.  If the call is
> hardcoded ("new_func();") then of course you know the name there too.
> Perhaps if you explained what you're trying to accomplish...
>
> --
> CC


--- End Message ---
--- Begin Message ---
just a thought, mac line break is "\r"

you can open and save it as unix that should get rid of the weird 
problem, unless you need it to work for numerous uncotrolled file flow, 
then replacing "\r" might work with a FOR loop. You might have to fwrite 
to a new file there "\r" will become "\n" and have that be processed as a 
continuum of the same script.

R>

>Rodrigo Peres wrote:
>> Hi list,
>> 
>> I'm in a problem that is driving me crazy!!! I want open a file and puts 
>> each line into an array, but this files was created in macintosh!! so 
>> the file() can't recognize the end line and only outputs 1 element in 
>> array!! How can I solve it. I tried to fread() the file and 
>> eregi_replace the line breaks, it worked, but now I don't know how to 
>> use this to create the array!
>> 
>
>You can use split().
>I think Mac linebreak is better to be recognized by PHP...
>
>--
>Yasuo Ohgaki
>
>
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>


________________________--__-______-______________
eat pasta
type fasta

--- End Message ---
--- Begin Message ---

Here's a bug report:

  file() - incorrect behavior (line endings ignored) on 
           files with Mac EOLN (CR)

           http://bugs.php.net/bug.php?id=16521

Maybe some kind soul will fix this before PHP 4.3.0 :)

  http://cvs.php.net

Regards,
Philip Olson


On Thu, 2 May 2002, eat pasta type fasta wrote:

> just a thought, mac line break is "\r"
> 
> you can open and save it as unix that should get rid of the weird 
> problem, unless you need it to work for numerous uncotrolled file flow, 
> then replacing "\r" might work with a FOR loop. You might have to fwrite 
> to a new file there "\r" will become "\n" and have that be processed as a 
> continuum of the same script.
> 
> R>
> 
> >Rodrigo Peres wrote:
> >> Hi list,
> >> 
> >> I'm in a problem that is driving me crazy!!! I want open a file and puts 
> >> each line into an array, but this files was created in macintosh!! so 
> >> the file() can't recognize the end line and only outputs 1 element in 
> >> array!! How can I solve it. I tried to fread() the file and 
> >> eregi_replace the line breaks, it worked, but now I don't know how to 
> >> use this to create the array!
> >> 
> >
> >You can use split().
> >I think Mac linebreak is better to be recognized by PHP...
> >
> >--
> >Yasuo Ohgaki
> >
> >
> >
> >
> >-- 
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> 
> ________________________--__-______-______________
> eat pasta
> type fasta
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
I agree -- if this is a once-off problem, then just open the file in a
Windows or Unix machine, re-save it, and the problem should be solved.

If the Mac user has BBEdit or BBEdit lite, one of the options they have is
to save in Unix and Windows format, which fixes the problem simply.


Of course if this is an ongoing thing, or if you don't have control over the
mac user, or the opportunity to convert the files as above, then there seem
to be some other ideas floating around this thread :)


Justin French


on 02/05/02 2:49 PM, eat pasta type fasta ([EMAIL PROTECTED]) wrote:

> just a thought, mac line break is "\r"
> 
> you can open and save it as unix that should get rid of the weird
> problem, unless you need it to work for numerous uncotrolled file flow,
> then replacing "\r" might work with a FOR loop. You might have to fwrite
> to a new file there "\r" will become "\n" and have that be processed as a
> continuum of the same script.
> 
> R>
> 
>> Rodrigo Peres wrote:
>>> Hi list,
>>> 
>>> I'm in a problem that is driving me crazy!!! I want open a file and puts
>>> each line into an array, but this files was created in macintosh!! so
>>> the file() can't recognize the end line and only outputs 1 element in
>>> array!! How can I solve it. I tried to fread() the file and
>>> eregi_replace the line breaks, it worked, but now I don't know how to
>>> use this to create the array!
>>> 
>> 
>> You can use split().
>> I think Mac linebreak is better to be recognized by PHP...
>> 
>> --
>> Yasuo Ohgaki
>> 
>> 
>> 
>> 
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
> 
> 
> ________________________--__-______-______________
> eat pasta
> type fasta
> 

--- End Message ---
--- Begin Message ---
Hi to everyone,

I am having trouble with this snip and wonder if you might help?

This is suppose to display the items 5 accross the browser instead it
displays them down like this:

item 1
item 2
item 3

I want them displayed like this:

item1 item 2 item 3

but for some odd reason it wont any ideas why?

if ($main == "shop")
{
$get_shop_data = mysql_fetch_array(mysql_query("SELECT * FROM wt_items WHERE
id = '$shopid'"));
$get_items = mysql_query("SELECT * FROM wt_instock WHERE shop = '$shopid'
AND howmany > '0'");
while ($items_result = mysql_fetch_array($get_items))
{
$item_info = mysql_fetch_array(mysql_query("SELECT * FROM wt_items WHERE id
= '$items_result[item]'"));
$column++;

$display_block ="<a
href=$php_self?main=buyitem&itemid=$items_result[id]><img
src=images/items/$item_info[image] height=75 width=75><BR><B>
$item_info[name]</B></a><BR> $items_result[howmany] in stock<BR>Cost:
$items_result[price]<BR>
";
echo "<table cellSpacing=0 cellPadding=0 width=\"100%\" border=0><tr><td
width = \"100\">$display_block</td>";

     if ($column > 5)
     {
          echo "</tr><tr>";
          $column = 1;
     }
           echo"</table>";
}
}

Thanks for your time and help
Jennifer
--
The sleeper has awaken


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002


--- End Message ---
--- Begin Message ---
At 10:27 PM -0700 1/5/02, Jennifer Downey wrote:

>echo "<table cellSpacing=0 cellPadding=0 width=\"100%\" border=0><tr><td
>width = \"100\">$display_block</td>";

Because you're opening a new table for every element.

 ...R.
--- End Message ---
--- Begin Message ---
Hello:
> The big disappointment was QaDRAM Studio, which was so
> buggy and unstable, it only took me until I tried to
> create a project (the first thing I did upon loading
> the software) before it crashed my entire system and
> forced me to reboot. Trying to uninstall it is
> impossible, as well, since when I try to repair,
> remove, or modify it, it proceeds to tell me that it
> can't do any of these on software that isn't
> installed. Go figure, since I installed it about five
> minutes prior. I stayed away from this after about
> thirty seconds. I can only promise these results in
> Win98; any other system, install at your own risk.
It is an unfinished product, I pointed out to let you know its existence,
it's not ready for production at all. Respect the problems you had it really
suprise me, no one of the near 15000 downloads I have had since the
beginning of the product has told me anything similar, so I would like very
much you reproduce the problem and send it to me via e-mail or submit it at
http://bugs.qadram.com to be able to fix it, I would be eternally grateful.

Best Regards.
----------------------------------------------------
QaDRAM Studio, RAD Development for the WEB
http://studio.qadram.com

--- End Message ---
--- Begin Message ---
use vim (http://www.vim.org/)

highlight syntax
code complition
autoindent
and more...
:q

José León Serna a écrit :

> Hello:
> > The big disappointment was QaDRAM Studio, which was so
> > buggy and unstable, it only took me until I tried to
> > create a project (the first thing I did upon loading
> > the software) before it crashed my entire system and
> > forced me to reboot. Trying to uninstall it is
> > impossible, as well, since when I try to repair,
> > remove, or modify it, it proceeds to tell me that it
> > can't do any of these on software that isn't
> > installed. Go figure, since I installed it about five
> > minutes prior. I stayed away from this after about
> > thirty seconds. I can only promise these results in
> > Win98; any other system, install at your own risk.
> It is an unfinished product, I pointed out to let you know its existence,
> it's not ready for production at all. Respect the problems you had it really
> suprise me, no one of the near 15000 downloads I have had since the
> beginning of the product has told me anything similar, so I would like very
> much you reproduce the problem and send it to me via e-mail or submit it at
> http://bugs.qadram.com to be able to fix it, I would be eternally grateful.
>
> Best Regards.
> ----------------------------------------------------
> QaDRAM Studio, RAD Development for the WEB
> http://studio.qadram.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
  Marius Ursache (3563 || 3494)

                           \|/ ____ \|/
                           "@'/ ,. \`@"
                           /_| \__/ |_\
                              \__U_/


--- End Message ---
--- Begin Message ---
How do I Install PHP on Apache 2, on win32?

I would like to install the ISAPI module?

Thanks



--- End Message ---
--- Begin Message ---
I have been told to point your line for php in httpd.conf to
apache2filter.dll in the experimental folder (PHP 4.2.0) but haven't been
able to get that to work.

-Kirk


"Philip Newman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> How do I Install PHP on Apache 2, on win32?
>
> I would like to install the ISAPI module?
>
> Thanks
>
>
>


--- End Message ---
--- Begin Message ---
 It doesn't look like it works.
move back to 1.3.24
there are no probs there



"Philip Newman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> How do I Install PHP on Apache 2, on win32?
>
> I would like to install the ISAPI module?
>
> Thanks
>
>
>


--- End Message ---
--- Begin Message ---

try to send the same url + start=8
index.php?left=news&ltitle=index&lext=php&start=8


Jule a écrit :

> Hey,
>
> i've got a little problem:
>
> I have two php pages
>
> index.php and news/index.php
>
> now in index.php there is a table which shows news/index.php
>
> $left = "news";
> $ltitle = "index";
> $lext= "php";
>
> include ("$left/$ltitle.$lext");
>
> now this allows me to keep the layout the same, but change the pages within
> the table using URL commands
>
> index.php?left=news&ltitle=index&lext=php
>
> now news/index.php takes a variable: $start
>
> if (empty($start)) $start= "0";
> $end = $start+8;
>
> $Query = "SELECT * from $TableName ORDER BY postdate DESC LIMIT $start, $end";
>
> this is to show eight(8) news articles at a time.
> now also on the news/index.php page there is a link next to show the next 8
> articles.
>
> <a href=index.php?lext=php?start=8>next</a>
>
> so this should link to the index page, which calls upon news/index.php, opens
> it in the left column of the table, and gives $start the value of 8.
>
> but it gives me this error:
>
> Warning: Failed opening 'news/index.php?start=8' for inclusion
> (include_path='') in /home/blindtheory/web/newweb/index.php on line 31
>
> so how can i solve this and get the articles to show in groups of 8?
>
> thanks in advance.
>
> Jule
> --
> Jule Slootbeek
> [EMAIL PROTECTED]
> http://blindtheory.cjb.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
  Marius Ursache (3563 || 3494)

                           \|/ ____ \|/
                           "@'/ ,. \`@"
                           /_| \__/ |_\
                              \__U_/


--- End Message ---
--- Begin Message ---
On Wed, 1 May 2002, Kelly Meeks wrote:

> Is is possible to use php to admin a password file used by a .htaccess file?

        You should check the File_Passwd class from PEAR.

        http://chora.php.net/cvs.php/php4/pear/File

-- 
Mika Tuupola                      http://www.appelsiini.net/~tuupola/

--- End Message ---
--- Begin Message ---
Hey there,

why do these work:
$vars = "vars";
$ar[0] = "arrays";
$hash['vars'] = "hashes";
str = "I can use $vars in strings";
str = "I can use $ar[0] in string";

while this one doesn't:
str = "I can NOT use $hash['vars'] in strings";

Kind regards

--- End Message ---
--- Begin Message ---
I don't know the answer to why, but you can do this:

$str = "I can use ".$hash['vars']." in strings";

:)

Justin French
--------------------
Creative Director
http://Indent.com.au
--------------------



on 02/05/02 6:42 PM, Ferry van Steen ([EMAIL PROTECTED]) wrote:

> Hey there,
> 
> why do these work:
> $vars = "vars";
> $ar[0] = "arrays";
> $hash['vars'] = "hashes";
> str = "I can use $vars in strings";
> str = "I can use $ar[0] in string";
> 
> while this one doesn't:
> str = "I can NOT use $hash['vars'] in strings";
> 
> Kind regards
> 

--- End Message ---
--- Begin Message ---
Hi,

I think this will accomplish what your trying to achieve.

 $str = "I can use $hash[vars] in strings";

However, this will not work for multi dimensional arrays... eg:

 $hash['var']['var2'] = "Elephant";
 $str = "I can NOT use $hash[var][var2] in strings";

will output "I can NOT use Array[var2] in strings". For this you have to
jump out of the string and use contcatination... eg:

 $str = "I can use ".$hash[var][var2]." in strings";

will output "I can use Elephant in strings".

Hope that helps :)

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd

> Hey there,
>
> why do these work:
> $vars = "vars";
> $ar[0] = "arrays";
> $hash['vars'] = "hashes";
> str = "I can use $vars in strings";
> str = "I can use $ar[0] in string";
>
> while this one doesn't:
> str = "I can NOT use $hash['vars'] in strings";
>
> Kind regards
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Ferry van Steen wrote:
> while this one doesn't:
> str = "I can NOT use $hash['vars'] in strings";

Try this one:

str = "I can NOT use ".$hash['vars']." in strings";
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Ferry van Steen [mailto:[EMAIL PROTECTED]]
> Sent: 02 May 2002 09:42
> 
> why do these work:
> $vars = "vars";
> $ar[0] = "arrays";
> $hash['vars'] = "hashes";
> str = "I can use $vars in strings";
> str = "I can use $ar[0] in string";
> 
> while this one doesn't:
> str = "I can NOT use $hash['vars'] in strings";

Because the string parser doesn't believe ' is a valid character as part of the 
"variable name" following a $.  Fortunately, this is catered for by using braces to 
delimit your $-specification, thusly:

    $str = "I CAN use {$hash['vars']} in strings";

The {} notation can be used to delimit any $ specification, even simple ones in cases 
where you might otherwise have ambiguity.  For example, this will work (even if 
ungrammatically!):

   echo "Today is the {$date}th of $month."

where this won't:

   echo "Today is the $dateth of $month."

I strongly recommend using {} if in any doubt -- it can't do any harm, and may just 
save you tearing your hair out looking for that elusive bug!!

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
Thanks for the replies peoples :-)


-----Original Message-----
From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]]
Sent: donderdag 2 mei 2002 11:13
To: 'Ferry van Steen'; [EMAIL PROTECTED]
Subject: RE: [PHP] Hashes in strings


> -----Original Message-----
> From: Ferry van Steen [mailto:[EMAIL PROTECTED]]
> Sent: 02 May 2002 09:42
> 
> why do these work:
> $vars = "vars";
> $ar[0] = "arrays";
> $hash['vars'] = "hashes";
> str = "I can use $vars in strings";
> str = "I can use $ar[0] in string";
> 
> while this one doesn't:
> str = "I can NOT use $hash['vars'] in strings";

Because the string parser doesn't believe ' is a valid character as part of
the "variable name" following a $.  Fortunately, this is catered for by
using braces to delimit your $-specification, thusly:

    $str = "I CAN use {$hash['vars']} in strings";

The {} notation can be used to delimit any $ specification, even simple ones
in cases where you might otherwise have ambiguity.  For example, this will
work (even if ungrammatically!):

   echo "Today is the {$date}th of $month."

where this won't:

   echo "Today is the $dateth of $month."

I strongly recommend using {} if in any doubt -- it can't do any harm, and
may just save you tearing your hair out looking for that elusive bug!!

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
Not really sure but str has to be $str, and I usually do print lines like
this
$str = "I can NOT use ".$hash['vars']." in strings";

the . will concat the strings together.

Hope this helps, 

-Steve


-----Original Message-----
From: Ferry van Steen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 02, 2002 4:42 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Hashes in strings


Hey there,

why do these work:
$vars = "vars";
$ar[0] = "arrays";
$hash['vars'] = "hashes";
str = "I can use $vars in strings";
str = "I can use $ar[0] in string";

while this one doesn't:
str = "I can NOT use $hash['vars'] in strings";

Kind regards


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

I would suggest not to use $hash[var1][var2] instead of
$hash['var1']['var2'] because afaik php will think u mean two constants (
var1 and var2 ).
Just if it doesnt find these constants it will use them as
$hash['var1']['var2'].


Markus Mirsberger


"Dan Hardiker" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I think this will accomplish what your trying to achieve.
>
>  $str = "I can use $hash[vars] in strings";
>
> However, this will not work for multi dimensional arrays... eg:
>
>  $hash['var']['var2'] = "Elephant";
>  $str = "I can NOT use $hash[var][var2] in strings";
>
> will output "I can NOT use Array[var2] in strings". For this you have to
> jump out of the string and use contcatination... eg:
>
>  $str = "I can use ".$hash[var][var2]." in strings";
>
> will output "I can use Elephant in strings".
>
> Hope that helps :)
>
> --
> Dan Hardiker [[EMAIL PROTECTED]]
> ADAM Software & Systems Engineer
> First Creative Ltd
>
> > Hey there,
> >
> > why do these work:
> > $vars = "vars";
> > $ar[0] = "arrays";
> > $hash['vars'] = "hashes";
> > str = "I can use $vars in strings";
> > str = "I can use $ar[0] in string";
> >
> > while this one doesn't:
> > str = "I can NOT use $hash['vars'] in strings";
> >
> > Kind regards
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--- End Message ---
--- Begin Message ---
Hi,

> I would suggest not to use $hash[var1][var2] instead of
> $hash['var1']['var2'] because afaik php will think u mean two constants
> ( var1 and var2 ).
> Just if it doesnt find these constants it will use them as
> $hash['var1']['var2'].

Thats correct, php will think they are constants and upon not finding them
will send up a low priority error (I think its of E_NOTICE). Appologies for
sloppy coding (must remember to be more awake).

$hash['var1']['var2'] is much better, safer, more compatable and faster
(marginally - as it doesnt have to check for constants of that name). As an
extra note, (and this of personal desire rather than coding standards), I
would always break out of a string to insert variables. Personally it just
highlights the dynamic parts of string creation.

eg: = "Name: ".$user->name." is age ".$user->age.". ".(($user-
>birthday==$today)?"Happy Birthday!")."<br />";

but thats getting out of the scope of the question heh

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd


--- End Message ---
--- Begin Message ---
Hi,

[a little background, feel free to skim]

The company I have been working for have been considering moving over to a
CVS based version control system for a while and I have been elected to
investiate the fesability.

We have a network of PHP files linked together via include / require /
require_once etc inside the source tree in a multitude of directories. A
sample tree structure might be something like:

 + Project Base files
 |
 +-- Core Handlers (mysql, sessions, authentication, security etc)
 +-- Data Handlers (abstraction layer between project and various db models)
 +-- General Functionality (smtp / nntp / imap abstract classes as well as
custom functions for things like data conversion)
 +-- Output Handlers (conversion modules for things like outputting stuff
in XML / HTML / XHTML / UML / CSV / even some things as word documents etc)

[ stop skimming here ]

Because these files are stored in the CVS repository, if I was to check out
(for example) an XML output handler and make some modifications to the
encoding types ... how would I test my changes before commital? (I
obviously wouldnt want to break the repository files)

As these files need to be executed via a web browser, I can only think I
would have to check out *all* the files, and then point my webserver at my
local directory. Then I only check back in the ones I change, releasing the
others.

This is not too bad if Im on my own but when multiple people are working on
the same tree together there will be locks all over the place as CVS wont
know which file I am working on. It will just know Ive checked out all the
files.

Ideas and Samples of how other people have broached this issue are most
welcome. Please include my email address in the reply and remove the [PHP]
tag from the subject.

Thanks

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd


--- End Message ---
--- Begin Message ---
At 10:08 AM +0100 2/5/02, Dan Hardiker wrote:

>As these files need to be executed via a web browser, I can only think I
>would have to check out *all* the files, and then point my webserver at my
>local directory. Then I only check back in the ones I change, releasing the
>others.

Yes, you need to use a local copy of the entire site for development.
If you're doing your editing on a machine not running a web server, PHP
and a database this causes some problems.

To get around this I generally run two versions of a site on the
server. I make and verify all the changes on a development version
then move the entire development site to the live server.

This can still be tricky, as you don't want the development site
working with the live data. So you need to run a test database as
well.


>This is not too bad if Im on my own but when multiple people are working on
>the same tree together there will be locks all over the place as CVS wont
>know which file I am working on. It will just know Ive checked out all the
>files.

You need to do more reading on the way CVS works. Everyone can work on
whatever files they like. There won't be any locks at all. Except when
someone is actively checking in some modifications (typically a few
seconds).

The C in CVS means concurrent. Which means multiple users working on
the files at once.

 ...R.
--- End Message ---
--- Begin Message ---
Thanks for the input, for added information - we have a multitude of
servers, 1 software development one plus several live servers.

The aim is to have the live servers cvsup the latest "STABLE" branch from
the development / deployment server... the issue of concurrent working is
strickly in the development realm as there are usually 2 / 3 developers
working on the same area of the project at the same time (one might modify
the input algorythms, while another improves the security for example).

I'll see what I can do with your suggestion.. Ive read through the entire
documentation at cvshome.org (man that was a labourous task) and I still
dont think I grasp it fully... guess its time to jump in at the deep end.

Thanks

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd

> At 10:08 AM +0100 2/5/02, Dan Hardiker wrote:
>
>>As these files need to be executed via a web browser, I can only think
>>I would have to check out *all* the files, and then point my webserver
>>at my local directory. Then I only check back in the ones I change,
>>releasing the others.
>
> Yes, you need to use a local copy of the entire site for development.
> If you're doing your editing on a machine not running a web server, PHP
> and a database this causes some problems.
>
> To get around this I generally run two versions of a site on the
> server. I make and verify all the changes on a development version then
> move the entire development site to the live server.
>
> This can still be tricky, as you don't want the development site
> working with the live data. So you need to run a test database as
> well.
>
>
>>This is not too bad if Im on my own but when multiple people are
>>working on the same tree together there will be locks all over the
>>place as CVS wont know which file I am working on. It will just know
>>Ive checked out all the files.
>
> You need to do more reading on the way CVS works. Everyone can work on
> whatever files they like. There won't be any locks at all. Except when
> someone is actively checking in some modifications (typically a few
> seconds).
>
> The C in CVS means concurrent. Which means multiple users working on
> the files at once.
>
> ...R.



--- End Message ---
--- Begin Message ---
I have a script that outputs this:
0.023884057998657

What's the command to make it shrink down to this:
0.023


I thought it was eregi() something, but I forgot.  sorry  

Cheers

(I've spent the last 10 minutes reading the manual, can't find it!!!)



--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] (Liam Mackenzie) wrote:

 > I have a script that outputs this:
 > 0.023884057998657
>
 > What's the command to make it shrink down to this:
 > 0.023

round()

-- 
Henrik Hansen
--- End Message ---
--- Begin Message ---

> I have a script that outputs this:
> 0.023884057998657
>
> What's the command to make it shrink down to this:
> 0.023
>
>
> I thought it was eregi() something, but I forgot.  sorry

It depends on what you need.

If you want to round the number off to 3 decimal points use the round()
function.  However if you don't want to round and instead just want to
truncate the number, the number_format() function would be what you need.

Sincerely,

Craig Vincent


--- End Message ---
--- Begin Message ---
>> I have a script that outputs this:
>> 0.023884057998657
>>
>> What's the command to make it shrink down to this:
>> 0.023
>>
>> I thought it was eregi() something, but I forgot.  sorry
>
> It depends on what you need.
>
> If you want to round the number off to 3 decimal points use the round()
> function.  However if you don't want to round and instead just want to
> truncate the number, the number_format() function would be what you
> need.
>
> Sincerely,
>
> Craig Vincent
>

If speed is an issue, instead of using number_format for truncation use
substr. i.e: echo substr($var, 0, 5); to get 3 dp.

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd


--- End Message ---
--- Begin Message ---
Just a general question of the best way to do it !
I've got a job search site with mysql at the back of it !
You choose on the first page - type of job, where and other bits,
go to the next page where query is done and then lists the jobs available!

Whats the best way of keeping this page temporarily in existence ??

I don't want the query to run every time when they have changed no
information and I don't want the Warning Page has expired please re-submit
details when the reload the page !

At the moment I'm thinking I can create a temporary static version of the
page ?
but would like to here some other opinions about it !

Thanks


--- End Message ---
--- Begin Message ---
> Whats the best way of keeping this page temporarily in existence ??
>
> I don't want the query to run every time when they have changed no
> information and I don't want the Warning Page has expired please re-submit
> details when the reload the page !
>
> At the moment I'm thinking I can create a temporary static version of the
> page ?
> but would like to here some other opinions about it !

You could generate temporary pages but unless they're on a ramdisk more than
likely they'll cause more disk i/o usage than just rerunning the query every
time the person accessed the page.  As for elimininating the repost warning
if someone refreshes the page that's simple....change your search for to use
the GET method instead of POST....this then has all the variables
transmitted via the URL and has no warning messages associated with it if a
person refreshes the page or returns to that page using the forward/back
navigation buttons on their browser.

Sincerely,

Craig Vincent


--- End Message ---
--- Begin Message ---
There are quite a few ways of doing this.

 1. Get MySQL to do the caching for you, using temporary tables.
 2. Get something like the Zend Cache to handle it transparently
 3. Use a global session (which everyone shares, or just specific groups of
people) which you can embed data in
 4. Use a ramdisk / mfs partition to store "hard copies".. if they are only
updated once a day, then disk I/O is unlikely to be a problem.
 5. Use shared memory to expand on number 3

The key questions you need to ask yourself are:

 1. Whats the scope of the caching? eg: per use, per page, per website...
 2. Whats the TTL (time to live) on the cache? eg: 5 mins, 5 visits, 5
hours, 5 days...
 3. Whats being cached? eg: MySQL results, processed results, derrived
information...

The answer to those questions will help you determine which one of the 5
options (there are ones other than the ones listed btw) you require.

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd

> Just a general question of the best way to do it !
> I've got a job search site with mysql at the back of it !
> You choose on the first page - type of job, where and other bits,
> go to the next page where query is done and then lists the jobs
> available!
>
> Whats the best way of keeping this page temporarily in existence ??
>
> I don't want the query to run every time when they have changed no
> information and I don't want the Warning Page has expired please
> re-submit details when the reload the page !
>
> At the moment I'm thinking I can create a temporary static version of
> the page ?
> but would like to here some other opinions about it !
>
> Thanks


--- End Message ---
--- Begin Message ---
You could use output buffering to write a static page of the results.

You basically turn on output buffering at the beginning of the script,
process as normal, and at the end, grab everything in the buffer, write it
to disk, then use header() to direct the person to that page.

Make a cron script that deletes old files periodically.

---John Holmes...
----- Original Message -----
From: "Dan Hardiker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, May 02, 2002 6:03 AM
Subject: Re: [PHP] Opinions Wanted


> There are quite a few ways of doing this.
>
>  1. Get MySQL to do the caching for you, using temporary tables.
>  2. Get something like the Zend Cache to handle it transparently
>  3. Use a global session (which everyone shares, or just specific groups
of
> people) which you can embed data in
>  4. Use a ramdisk / mfs partition to store "hard copies".. if they are
only
> updated once a day, then disk I/O is unlikely to be a problem.
>  5. Use shared memory to expand on number 3
>
> The key questions you need to ask yourself are:
>
>  1. Whats the scope of the caching? eg: per use, per page, per website...
>  2. Whats the TTL (time to live) on the cache? eg: 5 mins, 5 visits, 5
> hours, 5 days...
>  3. Whats being cached? eg: MySQL results, processed results, derrived
> information...
>
> The answer to those questions will help you determine which one of the 5
> options (there are ones other than the ones listed btw) you require.
>
> --
> Dan Hardiker [[EMAIL PROTECTED]]
> ADAM Software & Systems Engineer
> First Creative Ltd
>
> > Just a general question of the best way to do it !
> > I've got a job search site with mysql at the back of it !
> > You choose on the first page - type of job, where and other bits,
> > go to the next page where query is done and then lists the jobs
> > available!
> >
> > Whats the best way of keeping this page temporarily in existence ??
> >
> > I don't want the query to run every time when they have changed no
> > information and I don't want the Warning Page has expired please
> > re-submit details when the reload the page !
> >
> > At the moment I'm thinking I can create a temporary static version of
> > the page ?
> > but would like to here some other opinions about it !
> >
> > Thanks
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
hi all,
i m using php4.0.1
can anyone pls help me out, in doing email-attachment.
the code written for it, working and sending the email but the attachment is
not getting done.
Do we have to upload the file first, which is to be attached?

swati.
--- End Message ---
--- Begin Message ---
> Do we have to upload the file first, which is to be attached?

No. When you press the submit button, just speak slowly and clearly where
the file is and PHP will understand you. What kind of video card do you
have?

---John Holmes...

--- End Message ---
--- Begin Message ---
Hello everybody,

I would like to know an easy way to check is a daemon is running.

What do you think is the best? Try to read a .pid file from the right
directory? Use sockets function to try to connect to the listening port of
the daemon? Grep the output of "ps -e" ?

Thanks for your help !

Gilles.
--- End Message ---
--- Begin Message ---
What type of daemon?

eg: To see if my pop3 daemon is running I use sockstat... "sockstat | grep
110" and process the output.
eg: To see if my mail redirect daemon is running I
check /var/run/red_mail.pid

All depends on what you want to do as to how you do it. You could even do
it in a multitude of ways and use the resulting matrix to determine.

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd

> Hello everybody,
>
> I would like to know an easy way to check is a daemon is running.
>
> What do you think is the best? Try to read a .pid file from the right
> directory? Use sockets function to try to connect to the listening port
> of the daemon? Grep the output of "ps -e" ?
>
> Thanks for your help !
>
> Gilles.


--- End Message ---
--- Begin Message ---
I would like to monitor 3 different daemon : postfix, amavisd (a virus
scanner acting as a content filter for postfix) and spamd (SpamAssassin, a
spam filtering daemon invoked by procmail acting as an SMTP server).

Can we be sure that a daemon is running if the .pid file exist? 

Gilles.

-----Original Message-----
From: Dan Hardiker [mailto:[EMAIL PROTECTED]] 
Sent: jeudi 2 mai 2002 12:13
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Test if a daemon is running...


What type of daemon?

eg: To see if my pop3 daemon is running I use sockstat... "sockstat | grep
110" and process the output.
eg: To see if my mail redirect daemon is running I
check /var/run/red_mail.pid

All depends on what you want to do as to how you do it. You could even do it
in a multitude of ways and use the resulting matrix to determine.

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd

> Hello everybody,
>
> I would like to know an easy way to check is a daemon is running.
>
> What do you think is the best? Try to read a .pid file from the right 
> directory? Use sockets function to try to connect to the listening 
> port of the daemon? Grep the output of "ps -e" ?
>
> Thanks for your help !
>
> Gilles.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
No we cant. As the process itself creates the pid then there is no
gaurentee that the process is live (eg: it could have been kill -9ed, or
the box hard-booted)... however if there is no pid file (and the process
usually manages one) then you can be sure that the process is *not*
running. As such its usually a good first port of call.

If the pid file DOES exist, pull out the id and grep "ps aux" for it. If
you find it then you can check the status of the process and determine what
state its in. If the process doesnt exist in the ps aux - its dead.

If you dont get a pid file in normal execution (or you dont have access to
it) ... then your gonna have to do it the long winded way (greping out
unique attributes from a ps auxww / sockstat etc).

Good luck

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd

> I would like to monitor 3 different daemon : postfix, amavisd (a virus
> scanner acting as a content filter for postfix) and spamd
> (SpamAssassin, a spam filtering daemon invoked by procmail acting as an
> SMTP server).
>
> Can we be sure that a daemon is running if the .pid file exist?
>
> Gilles.
>
> -----Original Message-----
> From: Dan Hardiker [mailto:[EMAIL PROTECTED]]
> Sent: jeudi 2 mai 2002 12:13
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Test if a daemon is running...
>
>
> What type of daemon?
>
> eg: To see if my pop3 daemon is running I use sockstat... "sockstat |
> grep 110" and process the output.
> eg: To see if my mail redirect daemon is running I
> check /var/run/red_mail.pid
>
> All depends on what you want to do as to how you do it. You could even
> do it in a multitude of ways and use the resulting matrix to determine.
>
> --
> Dan Hardiker [[EMAIL PROTECTED]]
> ADAM Software & Systems Engineer
> First Creative Ltd
>
>> Hello everybody,
>>
>> I would like to know an easy way to check is a daemon is running.
>>
>> What do you think is the best? Try to read a .pid file from the right
>> directory? Use sockets function to try to connect to the listening
>> port of the daemon? Grep the output of "ps -e" ?
>>
>> Thanks for your help !
>>
>> Gilles.


--- End Message ---
--- Begin Message ---
Hi all,
i want ask something : How to upload files from local to server via php
?
and i want use it with browser.
Please gimme the code.

Thank You

--
  Kalpin Erlangga Silaen
     Kalpin is [EMAIL PROTECTED]
             Kalpin is not a irc warrior
   http://www.geocities.com/kalpinus
      Ready or Not, He will come


--- End Message ---
--- Begin Message ---
You might be new to this group, so I'm going to try not to flame you.

1. this group is not for "gimmie the code" -- commonly it's for focused
questions and issues.

2. this topic has been discussed on this list 1000's of times... a quick
search of the archives may in fact reveal a large chunk of code you could
'borrow'.  you should have checked there before asking.

3. if you searched the manual for "file upload", you would have found this
page, wish basically gives you all the code you need
http://www.php.net/manual/en/html/features.file-upload.html

4. i'm sure there are many sites with file upload scripts and classes
ready-to-roll.

5. you'll earn more if you don't just copy and paste everything.


Justin French
Indent.com.au





on 02/05/02 12:25 PM, Kalpin Erlangga Silaen ([EMAIL PROTECTED]) wrote:

> Hi all,
> i want ask something : How to upload files from local to server via php
> ?
> and i want use it with browser.
> Please gimme the code.
> 
> Thank You
> 
> --
> Kalpin Erlangga Silaen
> Kalpin is [EMAIL PROTECTED]
> Kalpin is not a irc warrior
> http://www.geocities.com/kalpinus
> Ready or Not, He will come
> 
> 

--- End Message ---
--- Begin Message ---
> Hi all,
> i want ask something : How to upload files from local to server via php
> ?
> and i want use it with browser.
> Please gimme the code.

Please give me a break. Read the manual, there is a whole chapter telling
you how to do this!

http://www.php.net/manual/en

Assuming you understand english.

---John Holmes...

--- End Message ---
--- Begin Message ---
[snip]
I am a webmaster for an agency.
I looked at many content management pieces for
Linux+Apache+PHP+MySQL like ezPublish and etc. but
they look overly complex for my needs.
I just need to have something that would allow me to
insert picture, text, and list of links into a
template. I don't want a heavy system, just something
lighweight. Any ideas?
Page would be like:
Picture
--------
Text
--------
List of links

All this would be taken from a MySQL and parsed via
PHP.
Thank you in advance

Or is there a nice program like Fireworks or GoLive,
but with ability to have object be pulled from database?
[/snip]

There are many options, including building your own.
[shameless plug]
I am writing a series of articles on building a CMS from scratch, The ABC's
of CMS;
http://www.evolt.org/article/The_ABCs_of_CMS/20/24182/index.html
[/shameless plug]

There is other good information about CMS there as well. Here are some other
resources;
http://www.cms-list.org/
http://www.cmswatch.com/
http://www.contentmanager.eu.com/
http://developer.ez.no/

HTH!

Jay Blanchard



--- End Message ---
--- Begin Message ---
Hi there!

I guess I got a very easy question for the pros here...
I've been searching the documentaion of mySQL, but didn't
find the answer (even though I'm sure it's out there 
somewhere :))...

Is a primary key in mySQL automatically indexed? And is a
unique field indexed automatically ?(I don't think and 
don't hope so, but one never knows)

Thanx,

Kiko

-- 
It's not a bug, it's a feature.
christoph starkmann
mailto:[EMAIL PROTECTED]
http://www.gruppe-69.com/
ICQ: 100601600
-- 
--- End Message ---
--- Begin Message ---
> I guess I got a very easy question for the pros here...
> I've been searching the documentaion of mySQL, but didn't
> find the answer (even though I'm sure it's out there
> somewhere :))...
>
> Is a primary key in mySQL automatically indexed? And is a
> unique field indexed automatically ?(I don't think and
> don't hope so, but one never knows)

Kind of off topic, but yes, they are both indexed. Use SHOW INDEX FROM
table_name to see the indexes.

---John Holmes...

--- End Message ---
--- Begin Message ---
Christoph,

Indexes are built on key fields, so yes. When a field is identified as a 
key it is indexed.

To answer your second question, it is the index which maintains the 
uniqueness of a field.

A book is a really good analogy. If you wanted to look up the references to 
"string", you can do it very quickly in the index. Even if you don't come 
close to the "s" section, you immediately know whether to look next to the 
right or to the left. If you push the issue, and act extremely dumb (like a 
computer), you'll find the page containing "string" within 7 hits; once 
you're on that page it's a short read to find the term. That's what makes 
searching on indexed fields so fast.

To find the term in the book requires you to start reading on page 1 and to 
read text until you find the term. Which why searches which do not take 
advantage of key fields are so slow.

Indexes are your friend, they don't slow down the addition of records that 
much, and make retrieval of records extremely fast.

Regards - Miles Thompson



At 02:13 PM 5/2/2002 +0200, Christoph Starkmann wrote:
>Hi there!
>
>I guess I got a very easy question for the pros here...
>I've been searching the documentaion of mySQL, but didn't
>find the answer (even though I'm sure it's out there
>somewhere :))...
>
>Is a primary key in mySQL automatically indexed? And is a
>unique field indexed automatically ?(I don't think and
>don't hope so, but one never knows)
>
>Thanx,
>
>Kiko
>
>--
>It's not a bug, it's a feature.
>christoph starkmann
>mailto:[EMAIL PROTECTED]
>http://www.gruppe-69.com/
>ICQ: 100601600
>--
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
To clarify, an indexed field is *not* inheriently unique. You can have an
indexed field which is not unique, and a unique field which is not indexed
(hence the options being available).

A primary key is both indexed and unique (with the slight adaption of
compound keys)... but this is majorly off topic.

http://www.mysql.com/doc/

- Dan

> Christoph,
>
> Indexes are built on key fields, so yes. When a field is identified as
> a  key it is indexed.
>
> To answer your second question, it is the index which maintains the
> uniqueness of a field.
>
> A book is a really good analogy. If you wanted to look up the
> references to  "string", you can do it very quickly in the index. Even
> if you don't come  close to the "s" section, you immediately know
> whether to look next to the  right or to the left. If you push the
> issue, and act extremely dumb (like a  computer), you'll find the page
> containing "string" within 7 hits; once  you're on that page it's a
> short read to find the term. That's what makes  searching on indexed
> fields so fast.
>
> To find the term in the book requires you to start reading on page 1
> and to  read text until you find the term. Which why searches which do
> not take  advantage of key fields are so slow.
>
> Indexes are your friend, they don't slow down the addition of records
> that  much, and make retrieval of records extremely fast.
>
> Regards - Miles Thompson
>
>
>
> At 02:13 PM 5/2/2002 +0200, Christoph Starkmann wrote:
>>Hi there!
>>
>>I guess I got a very easy question for the pros here...
>>I've been searching the documentaion of mySQL, but didn't
>>find the answer (even though I'm sure it's out there
>>somewhere :))...
>>
>>Is a primary key in mySQL automatically indexed? And is a
>>unique field indexed automatically ?(I don't think and
>>don't hope so, but one never knows)
>>
>>Thanx,
>>
>>Kiko
>>
>>--
>>It's not a bug, it's a feature.
>>christoph starkmann
>>mailto:[EMAIL PROTECTED]
>>http://www.gruppe-69.com/
>>ICQ: 100601600
>>--
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd


--- End Message ---
--- Begin Message ---
Hi,

Sorry to bud in on this, but I was thinking about writing my next php app
oop style to learn. Are you saying that It is going to be slower or 
poorer performance?

Thanks alot

-Steve the newbie.

-----Original Message-----
From: Julio Nobrega Trabalhando [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 6:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: why is better?


  Faster, and better interaction with the engine that runs php (and
therefore other parts of the system).
--

Julio Nobrega.

"Franky" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Why is better to write module than class?
> ok is compiled code so is supose to be faster, but that all?
>
> Frank
> [EMAIL PROTECTED]
>
>



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

"Steve Bradwell" <[EMAIL PROTECTED]> wrote in message
57A1618E7109D311A97D0008C7EBB3A1CBB2EA@KITCHENER">news:57A1618E7109D311A97D0008C7EBB3A1CBB2EA@KITCHENER...
> Hi,
>
> Sorry to bud in on this, but I was thinking about writing my next php app
> oop style to learn. Are you saying that It is going to be slower or
> poorer performance?

It will be slightly (in most cases, unnoticeably) slower.

On the other hand, if properly designed, it should be
easier to maintain and much more easily reuseable in
other projects.

I think that's a reasonable tradeoff.


--- End Message ---
--- Begin Message ---
  Slower, yes. But still faster than most of other web scripting languages,
at least from some benchmarks I've seen.

  But still, who wants to code with pointers and memory management and etc
when PHP do those kinds of difficult tasks, and the "normal" ones, while
taking less time to code? If you need critical speed, code a C module. But
that's not necessary, at least in some cases I have seen (the majority, I
must say ;-)

  Coding your whole web script in C or C++ will take weeks, months, if you
start from scratch. Php is designed for this enviroment, and you will get
less headcaches by using it (specially maintance and portability)....

  As usual, use the best suited hammer :-)

--

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


"Steve Bradwell" <[EMAIL PROTECTED]> wrote in message
57A1618E7109D311A97D0008C7EBB3A1CBB2EA@KITCHENER">news:57A1618E7109D311A97D0008C7EBB3A1CBB2EA@KITCHENER...
> Hi,
>
> Sorry to bud in on this, but I was thinking about writing my next php app
> oop style to learn. Are you saying that It is going to be slower or
> poorer performance?
>
> Thanks alot
>
> -Steve the newbie.
>
> -----Original Message-----
> From: Julio Nobrega Trabalhando [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 01, 2002 6:41 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: why is better?
>
>
>   Faster, and better interaction with the engine that runs php (and
> therefore other parts of the system).
> --
>
> Julio Nobrega.
>
> "Franky" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Why is better to write module than class?
> > ok is compiled code so is supose to be faster, but that all?
> >
> > Frank
> > [EMAIL PROTECTED]
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
OK thanks Miguel.

Miguel Cruz wrote:
> 
> *************************************************************************
> This Message Was Virus Checked With : SAVI 3.54 Feb 2002
> Last Updated 24th April 2002
> *************************************************************************
> 
> On Wed, 1 May 2002, Neil Freeman wrote:
> > How do you obtain the value of 'error_log' (set within a .htaccess
> > file). Is there a $HTTP_x_VARS array available which contains this
> > information?
> 
> Nope. You can use phpinfo() to see what most of the predefined server
> variables are. In your case you'll have to parse the httpd.conf file
> yourself.
> 
> miguel
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
--------------------------------
 Email:  [EMAIL PROTECTED]
         [EMAIL PROTECTED]
--------------------------------
--- End Message ---
--- Begin Message ---
Hi,

is it possible to get the HTML-Pagetitle with PHP?

Thanks for help.
Ivo
--- End Message ---
--- Begin Message ---
Ummmm, not sure what you're trying to achieve.

PHP is parsed on the server before it is sent to the browser.  So, since
you're the one writing the PHP file, you know what the page title is
already, don't you????

Unless you're talking about parsing an existing HTML page, and extracting
the title.

In either case, you need to be more specific about the circumstances and
what you want to achieve.


Justin
--------------------
Creative Director
http://Indent.com.au
--------------------



on 02/05/02 10:57 PM, Ivo Neuhauser ([EMAIL PROTECTED]) wrote:

> Hi,
> 
> is it possible to get the HTML-Pagetitle with PHP?
> 
> Thanks for help.
> Ivo

--- End Message ---
--- Begin Message ---
Sine PHP has so many string parsing functions, you can grab the text
betn.
<title>...</title>

e.g. HTML code:
<html>
....

..
</html>
Read the whole file by line into an array -
http://www.php.net/manual/en/function.file.php

search for line containing <title>....
for($lines as $onelineatatime) {
strpos($onelineatatime, "<title>")

remove <title> and </title>
substr()
> Hi,
>
> is it possible to get the HTML-Pagetitle with PHP?
>
> Thanks for help.
> Ivo
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan

--- End Message ---
--- Begin Message ---
G' morning!

Can someone tell me where to find the various options for the Header
function as it relates to M$ Excel? Yesterday, thanks to this list, we found
a way to open a worksheet in the browser and display data retrieved from a
database. The worksheet opens with no gridlines and displaying zero values,
I would like to see gridlines and no zero values. Are there options that can
be placed in the header function. I have looked at MSDN and did a Google
search that did not reveal much of anything.

Here is the header info being used...

header("Content-Type:  application/x-excel");
header("Content-Disposition: inline; filename=\"excel.xls\"");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

Thanks!

Jay Blanchard


--- End Message ---
--- Begin Message ---

"Tom Beidler" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

> My mistake. The correct code that works is;
>
> $display_time = date("H:i");
>
> // round time to nearest 15 minute interval
> $display_timex = explode (":",$display_time) ;
> if (($display_timex[1] >= 00) && ($display_timex[1] <= 07)) {
>     $insert_time = $display_timex[0] . ":00";
> } elseif (($display_timex[1] >= 8) && ($display_timex[1] <= 22)) {
>     $insert_time = $display_timex[0] . ":15";
> } elseif (($display_timex[1] >= 23) && ($display_timex[1] <= 37)) {
>     $insert_time = $display_timex[0] . ":30";
> } elseif (($display_timex[1] >= 38) && ($display_timex[1] <= 52)) {
>     $insert_time = $display_timex[0] . ":45";
> } elseif (($display_timex[1] >= 53) && ($display_timex[1] <= 59)) {
>     $display_timex[0]++;
>     $insert_time = $display_timex[0] . ":00";
> }

How 'bout:

// split it in a more readable way
list($hour, $min) = split(" ", date("H i"));

// calculate nearest quarter-hour
$quarters = (int) (($min + 7) / 15);

// check for round-to-next-hour
if (4 == $quarters) {
    $quarters = 0;
    $hour++;
}

// turn quarter-hours back into minutes
$min = 15 * $quarters;

// format final result
$insert_time = sprintf("%2i:%02i", $hour, $min);


--- End Message ---
--- Begin Message ---
Hi,

This is driving me nuts - all help appreciated!
The problem is that I can never get the html stuff output *after* having 
included "download.inc" because of the "exit;" call -- which I have to have 
else the html gets output and downloaded as well (and I don't understand why 
fpassthru doesn't stop at EOF on $fp).
Is there any way to do this without the user having to click on yet another 
link/button somewhere?

Donna

User clicks on a link in pageA.html:
<a href="./cribs.html?action=downloadtxt"><u>Download TXT</u></a>

cribs.html:
<?php 
if ( $action == 'downloadtxt' ) {
  include( '../include/downloadtxt.inc' );
  $action = 'howto';
}
if ( $action == 'howto' ) {
?>
<html>
 ... more html stuff here
</html>
<?php
}
?>

downloadtxt.inc:
<?php
  create a txt file, and then:
  header( "Content-Transfer-Encoding: base64" ); 
  ... more header stuff
  $fp = fopen( "$txtfile", "r" );
  fpassthru( $fp );
   exit;
?>
--- End Message ---
--- Begin Message ---
Hi,

> The problem is that I can never get the html stuff output *after*
> having  included "download.inc" because of the "exit;" call -- which I
> have to have  else the html gets output and downloaded as well (and I
> don't understand why  fpassthru doesn't stop at EOF on $fp).
[...]
> downloadtxt.inc:
> <?php
>  create a txt file, and then:
>  header( "Content-Transfer-Encoding: base64" );
>  ... more header stuff
>  $fp = fopen( "$txtfile", "r" );
>  fpassthru( $fp );
>   exit;
> ?>

Replace "exit;" with "fclose( $fp );". Please note that headers must be
sent before any other output.

What you are trying to achieve can be done with refresh headers (either
html-meta or http).

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd


--- End Message ---
--- Begin Message ---
On Thursday 02 May 2002 3:08 pm, Dan Hardiker wrote:
> Replace "exit;" with "fclose( $fp );".
Nope - tried this way back when - if you rtfm you will see that the file is 
closed when fpassthru() is done reading it.  If you use fclose what you get 
is this:
PHP Warning:  27 is not a valid File-Handle resource in ... 

> Please note that headers must be sent before any other output.
yah i know this - it's the major source of my problem!

> What you are trying to achieve can be done with refresh headers (either
> html-meta or http).
Huh? pls explain.

Donna
--- End Message ---
--- Begin Message ---
Hi there.

Could someone please let me know what is the best way to send multiple mails
to different users collected from a checkbox on the previous page.

There is a page that displays all the available recipients.  A users then
selects which recipients he wants to receive the mail.  Then the next page
should process this and send the mail off.

I am not sure how I should me sending the checkbox name and variables and
then how to actually insert the email addresses using the mail command.  Is
there a better way than using a checkbox?

Thanks
Kevin

--- End Message ---
--- Begin Message ---
Hi,

> I am not sure how I should me sending the checkbox name and variables
> and then how to actually insert the email addresses using the mail
> command.  Is there a better way than using a checkbox?

If you have a HTML form with a list of email addresses to send to you might
want the code to look something like:

 <input type='checkbox' name='sendTo[]' value='[EMAIL PROTECTED]' /> User
1<br />
 <input type='checkbox' name='sendTo[]' value='[EMAIL PROTECTED]' /> User
2<br />
 <input type='checkbox' name='sendTo[]' value='[EMAIL PROTECTED]' /> User
3<br />

Now in the resulting PHP code (assuming that you're using >= PHP v4.1.x and
using METHOD="get" in the form) you should find $_GET['sendTo'] is an array
of email addresses they ticked. Just add them as mail headers (you can find
simple instructions on the http://www.php.net/mail page in the user
comments).

If METHOD="post" then use $_POST, and if an old version of PHP is being
used then use $HTTP_POST_VARS / $HTTP_GET_VARS.

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd


--- End Message ---
--- Begin Message ---
Checkboxes are an easy way to do it.

The value of a checkbox will only be sent if it's checked. If it's not
checked, then that variable isn't even created.

So the easiest way to do it is to use the email address as the value, and
name the checkboxes all the same name with an [] to make it an array.

<input type=checkbox value='[EMAIL PROTECTED]' name='emails[]'>
<input type=checkbox value='[EMAIL PROTECTED]' name='emails[]'>

Then, on the page that processes this form, you'll have an $emails[] array
that'll contain all of your email addresses to send to. So you just do this:

$email_string = implode(";",$emails);
mail($email_string,$subject,$message);

If you can't pass the email addreses, directly, then you'll have to pass an
ID that relates to the email addresses. Name your checkboxes as ID[] or
something similar, and then you'll have an array of IDs to send the email
to.

---John Holmes...

----- Original Message -----
From: "Kevin Meredith" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Thursday, May 02, 2002 10:02 AM
Subject: [PHP] Multiple mails to be sent from checkbox selection


> Hi there.
>
> Could someone please let me know what is the best way to send multiple
mails
> to different users collected from a checkbox on the previous page.
>
> There is a page that displays all the available recipients.  A users then
> selects which recipients he wants to receive the mail.  Then the next page
> should process this and send the mail off.
>
> I am not sure how I should me sending the checkbox name and variables and
> then how to actually insert the email addresses using the mail command.
Is
> there a better way than using a checkbox?
>
> Thanks
> Kevin
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---

Reply via email to