OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: php-general-digest-helplists.php.net
Date: Sun Aug 19 2001 - 11:40:04 CDT

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    php-general Digest 19 Aug 2001 16:40:04 -0000 Issue 825

    Topics (messages 63351 through 63406):

    Re: Protecting include files
            63351 by: Dan Lowe
            63369 by: Tom Carter

    Re: Printf fails on large files
            63352 by: Moriyoshi Koizumi

    Re: if then else?
            63353 by: Glyndower

    force download in IE
            63354 by: David Minor

    function like exit?
            63355 by: nafiseh saberi
            63360 by: Christopher Sogge Røtnes

    Re: Slow LDAP Queries
            63356 by: Emilio Panighetti

    $var , '$var'
            63357 by: nafiseh saberi
            63362 by: Chris Lambert
            63363 by: Christopher Sogge Røtnes
            63364 by: ReDucTor

    Re: Search for PHP Motivation Studies
            63358 by: Björn Schotte

    cookie
            63359 by: nafiseh saberi
            63361 by: Christopher Sogge Røtnes

    Re: Browser Detection & Redirection -- PHP or Apache ???
            63365 by: Lutz Horn
            63397 by: Elias Santiago

    Re:if else
            63366 by: nafiseh saberi

    transaction
            63367 by: nafiseh saberi
            63372 by: Chris Lambert
            63386 by: Michael

    mysql , postgres
            63368 by: nafiseh saberi
            63373 by: Chris Lambert
            63376 by: Tom Carter
            63377 by: Chris Lambert
            63379 by: Michael
            63380 by: Michael
            63381 by: Tom Carter
            63382 by: indrek siitan
            63384 by: Michael

    Files from db vs. filesystem (was MySql or flat database using PHP)
            63370 by: Tom Carter

    Re: class variables and methods
            63371 by: Tom Carter
            63400 by: Joe Sheble \(Wizaerd\)
            63402 by: Tom Carter

    Count total
            63374 by: Martin Kampherbeek
            63375 by: Chris Lambert
            63378 by: Rasmus Lerdorf

    coding standards
            63383 by: Michael

    Smarty: Assigning custom function section variable
            63385 by: Alexander Skwar

    error in source !
            63387 by: nafiseh saberi
            63389 by: Hugh Bothwell
            63390 by: nafiseh saberi

    MySQL substrings?
            63388 by: Seb Frost
            63392 by: Tom Carter
            63396 by: Chris Lambert
            63398 by: Tom Carter
            63399 by: Seb Frost

    problems with a netscape post
            63391 by: P.pb1.pair.com, Bell.pb1.pair.com
            63403 by: Quentin Gillet
            63406 by: Steve Lawson

    PHP based authentification -----------
            63393 by: Alex Sofronie

    sendmail
            63394 by: BRACK

    Errors
            63395 by: BRACK

    virtual() ignoring str_replace()
            63401 by: Charlie Romero

    More SNMP Functions for PHPv4
            63404 by: Robert Schultz

    --enable-memory-limit - What does it do?
            63405 by: Kai Schaetzl

    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:


    Previously, John Meyer said:
    >
    > BTW, .inc files can include PHP code that is executed, right?

    Any file can contain such code, if the server is configured to interpret
    the file as a PHP file, or if another file which is PHP include()'s the
    file in question. The ".inc" extension just happens to be a popular choice
    that a lot of people tend to use for "included" PHP code. But typically as
    far as the server cares they're just text files.

     -dan

    -- 
    It's been said that a million monkeys at a million keyboards could produce
    the complete works of Shakespeare; now thanks to the Internet, we can say
    that this is not true.                       -Unknown
    

    attached mail follows:


    In addition to this you can place the file out of the web tree.... PHP can, AFAIK, include files based on their absolute file path, eg /home/config.inc. This means that there is no way to directly browse to a file

    (web tree is the part of a server/whatever that the webserver (eg apache) uses to load files when requested to)

    > Hi, > > I have a php script which includes .inc files. Is there any way in which I > can prevent a normal surferfrom viewing these files. Is there any command > that I can add to a .htaccess file. > > Thanks > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~ \\\\\\__________________________________ > ! SIDDHARTH HEGDE / CHAOSGAMERZ.COM ! > ! Webmaster \____ For PC Game screeshots, cheat ! > ! http://www.ChaosGamerz.COM o| o codes, trainers, downloads, ! > ! webmasterchaosgamerz.com( |_ game music, FREE e-mail and even ! > ! ICQ 84475206 |-- FREE FULL VERSION games for that ! > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \___/ 486------------------------------ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    attached mail follows:


    Hello,

    I don't think the problem you have is not the size of the file. It seems to depend on the content of that.

    (line 1) $a = 'abc%d'; (line 2) printf( "$a" );

    will cause too-few-arguments error because variable $a contains the sequence of '%','d', which should be interpreted as formatting characters if you don't want it.

    use print() instead of printf(), or do like this: printf ( "<font color=blue>%s</font>\n", $conteudo );h

    Moriyoshi

    "In$BqS(Bcia Sensorial Trabalhando" <inerteARROBAhotmail.compb1.pair.com> wrote:

    > He said no, here's the error: > > Warning: printf(): too few arguments in /htdocs/content.php on line 20 > > And here's the code. Remember that only fails on large files: > > <html> > <!-- GBJ --> > <head> > <title>SITUA$B%L%F(BO DA CAIXA POSTAL</title> > </head> > <body> > Resultado da Consulta para: <b><? printf ($login_usuario) ?></b>. > <pre> > <?php > opendir ("/var/mail"); > chdir ("/var/mail"); > // A vari$BaW(Bel $login_usuario obtida em index.html > // xxx.xxx.com.br/gbj/index.html > if (file_exists("$login_usuario")) { > printf ("<b>SITUA$B%L%F(BO DA CAIXA POSTAL</b>\n\n"); > $situacao = `ls -ld $login_usuario`; > printf ("<font color=blue>$situacao</font>\n"); > printf ("<b>CONTE$B%l(BDO DA CAIXA POSTAL</b>\n\n"); > $conteudo = `mailx -H -f /var/mail/$login_usuario`; > printf ("<font color=blue>$conteudo</font>\n"); > } > else > { > printf ("O usu$BaS(Bio $login_usuario <b>n$BeP(B foi encontrado</b>.\n"); > } > ?> > </pre> > </body> > </html> > > -- > > Julio Nobrega > > A hora est chegando: > http://toca.sourceforge.net > "John Meyer" <john_meyergeocities.com> wrote in message > news:5.1.0.14.0.20010817142852.009f4c10pop.mail.yahoo.com... > At 05:14 PM 8/17/01 -0300, In$BqS(Bcia Sensorial Trabalhando wrote: > > Hi All, > > > > A friend of mine said his printf is failing when he parses a variable > from > >a 4.5 mega file. On smaller files, it works fine. > > > > There's a limit on the printf or somewhere else? > > > > Thanks. > > > Is he throwing the _entire_ 4.5 MB file into that variable and trying to > print that? > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    attached mail follows:


    btw...this is the code i'm trying........

    Please keep the laughter to a minimum...ah heck with it...laugh all you want...its good for ya

    <?php if ($prof_exp_1 = "not null") { ?> <H4>Professional Experience: </H4><li> <?php printf(mysql_result($result,0,"prof_exp_1")); ?><br> <?php } else if ($prof_exp_1 = "null") {?> This field is empty <?php } else {?> output for users with a variable other than value1 or value2 <?php }; ?>

    <?php if ($prof_exp_2 = "not null") { ?> <li> <?php printf(mysql_result($result,0,"prof_exp_2")); ?><br> <?php } else if ($prof_exp_1 = "null") {?> This field is empty <?php } else {?> output for users with a variable other than value1 or value2 <?php }; ?>

    attached mail follows:


    Can anybody tell me why this doesn't work in IE? I need to force download mp3 files instead of IE5.5 trying to apply a helper app. This code works fine for NN.

    // detect for MSIE bug if (strstr($HTTP_USER_AGENT, "MSIE")) $attachment = ""; else $attachment = " attachment;"; // stream file to user header("Content-Type: application/octet-stream"); header("Content-Disposition:$attachment filename=$filename"); header("Content-Length: ".filesize($tmp_file)); header("Content-Transfer-Encoding: binary"); readfile($tmp_file);

    attached mail follows:


    hi. do we have function like "exit" in php?? for exit from program.

    best regards.

    attached mail follows:


    "Nafiseh Saberi" <nsaberiiraninfocenter.net> wrote in message news:200108190542.f7J5ggt28515persia.iraninfocenter.net... > > hi. > do we have function like "exit" in php?? > for exit from program. > > > best regards.

    For the love of.....

    1) yes. its called "exit" you can also use "die" 2) the simplest of searches on www.php.net would have told you that

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

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

    http://www.php.net/manual/en/ <---SmartThing[tm]

    Christopher

    attached mail follows:


    Andrew,

    Thanks for your input.

    Comments below...

    "Andrew Libby" <alibbycommnav.com> wrote in message news:20010818221256.A10788commnav.com... > Emilio, > > Few thoughts: > > o Is the call syntax you're using for ldap_read() correct? The online > manual page describes the second parameter as being the base dn, > you're passing the user's username. ( getenv("REMOTE_USER")). I'm > surprised that this code works.

    There's a parameter on httpd.conf that is: AuthLDAPRemoteUserIsDN On. I'm using the auth_ldap.so 1.6.0 from Dave Carrigan.

    When executing phpinfo(), REMOTE_USER returns this:

    uid=username,ou=People,dc=mydomain,dc=com

    That's why it works.

    > o The comparisons you're making: Are they comparing similar LDAP searches. > There are issues that may not involve PHP at all that could be the cause > of you're performance issue. For example, you're search could find all > entries with a cn attribute at the base dn. This could potentially be > a large number of entries. Also, if you search for something and the > attributes you reference in your search filter are not indexed performance > will degrade linearly as you add more entries to your directory.

    The searches are comparable. The perl function does the same, but in perl. This is the way I got around it. Actually, the PHP seems more efficient, but in Perl is a lot faster:

    #!/usr/bin/perl # General Declarations ------------------------------------------------- use Net::LDAP qw(:all); $webpage = new CGI; # Declare instanced. $client_user = getldapcn( $webpage->user_name ); # Web client user - from Auth.

    sub getldapcn { my ( $query )=_; my $retstr; $ldap = Net::LDAP->new( "localhost" ) or die "$"; $mesg = $ldap->bind( version => 3 ); $result = $ldap->search( base => "$query", scope => "sub", filter => "cn=*" ); foreach my $entr ( $result->entries ) { $retstr = $entr->get_value( "cn" ); } # close $ldap->unbind; return( $retstr ); } # That's it! -----------------------------------------------------------

    > o Session Caching. At CommNav, we've had good success with this strategy. > We store quite a bit of information in the users session. It's not > uncommon for our user sessions to grow to above 100Kb, and I've seen > them as big as 300Kb. Retrieving data from the session (i.e. the > unserialize() function) is much less expensive then going to LDAP for > every hit to the web app.

    Thanks. That's what I'm doing now, and it really makes a difference., but still, I don't know why the LDAP query takes so much time in the first place.

    > Since these thoughts are not related to PHP, you can feel free to contact > me off-list to discuss further. > > Andy

    Thanks, Emilio

    > > > On Sat, Aug 18, 2001 at 05:07:26PM -0400, Emilio Panighetti wrote: > > I have OpenLDAP and PHP 4.0.4p1 on a RedHat 7.1 (plain distribution, didn't > > recompile anything, and I use MOD_LDAP to authenticate users to an intranet > > site. I want PHP pages to show the real username so I have this function I > > call when I want to know the username. > > > > the mod_ldap queries and ldap queries from a Perl CGI return very fast. On > > Perl I don't notice an performance issue (with less than a couple > > queries/second), but each query using PHP takes about two full seconds (or > > more). I did a workaround keeping the result on a session variable, but it's > > still slow every time I call this function. > > mod_ldap stores the user's dn on the REMOTE_USER environment variable. > > > > Here's the function. I don't know how to make it faster. > > > > Thanks, > > Emilio Panighetti > > > > <?php > > // Retrieves user's real name from LDAP > > function ldapcnsearch() > > { > > $s_ldapserver = "localhost"; > > $s_ldapport = 389; > > $ds = ldap_connect( "ldap://".$s_ldapserver.":".$s_ldapport ); > > ldap_set_option( $ds, LDAP_OPT_PROTOCOL_VERSION, 3); > > $qar[] = "cn"; > > if ( $ds ) { > > $r = ldap_bind( $ds ); > > $sr = ldap_read( $ds, getenv( "REMOTE_USER" ), "cn=*", $qar, 0, 1, > > 1 ); > > $info = ldap_get_entries($ds, $sr); > > $s_RealName = $info[0]["cn"][0]; > > ldap_close( $ds ); > > return( $s_RealName ); > > } > > } > > ?> > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > > For additional commands, e-mail: php-general-helplists.php.net > > To contact the list administrators, e-mail: php-list-adminlists.php.net > > > > -- > -------------------------------------------------- > Andrew Libby > Director of Technology > CommNav, Inc > alibbycommnav.com

    attached mail follows:


    hi. what is the difference between $var and '$var' ?/ thanks.

    attached mail follows:


    In what context?

    print $var; // prints the value of $var print "$var"; // prints the value of $var print '$var'; // prints $var

    /* Chris Lambert, CTO - chriswhitecrown.net WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */

    ----- Original Message ----- From: nafiseh saberi <nsaberiiraninfocenter.net> To: <php-generallists.php.net> Sent: Sunday, August 19, 2001 2:33 AM Subject: [PHP] $var , '$var'

    | | hi. | what is the difference between $var and '$var' ?/ | thanks. | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: php-general-unsubscribelists.php.net | For additional commands, e-mail: php-general-helplists.php.net | To contact the list administrators, e-mail: php-list-adminlists.php.net | | |

    attached mail follows:


    "Nafiseh Saberi" <nsaberiiraninfocenter.net> wrote in message news:200108190633.f7J6XHZ15447persia.iraninfocenter.net... > > hi. > what is the difference between $var and '$var' ?/ > thanks.

    '$var' has little marks like this --> ' <--- around it call it a "border" useful when adding such item to a sql query or printing distinct. (when you get to regexping you cant live without such items)

    Chris

    attached mail follows:


    nothing, execpt, think there would be about 0.00001 time difference... :D I use $var = $blah."bleh'.$foo because syntax highlighting looks better :D - James "ReDucTor" Mitchelll ----- Original Message ----- From: "nafiseh saberi" <nsaberiiraninfocenter.net> To: <php-generallists.php.net> Sent: Sunday, August 19, 2001 4:33 PM Subject: [PHP] $var , '$var'

    > > hi. > what is the difference between $var and '$var' ?/ > thanks. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    attached mail follows:


    * Ralph Guzman wrote: > IN the book "Web Application Development with PHP 4.0" There is an entire > chapter towards the end of the book that describes such case studies.

    I know them but I don't search case studies.

    -- 
    Die Marktumfrage zu PHP Schulungen, Consultingdienstleistungen und
    frei verfügbaren Artikeln.
    

    Mitmachen? http://www.thinkphp.de/survey/survey.php

    attached mail follows:


    hi.

    what is cookie??

    thanks much.

    attached mail follows:


    "Nafiseh Saberi" <nsaberiiraninfocenter.net> wrote in message news:200108190642.f7J6g8j18350persia.iraninfocenter.net... > > hi. > > what is cookie?? > > thanks much.

    what the... oh its you again.

    I am too tired to give you the complete setup. Here is the short term explanation. Read the links below for more info.

    Chris INTRODUCTION Cookies are a general mechanism which server side connections (such as CGI scripts) can use to both store and retrieve information on the client side of the connection. The addition of a simple, persistent, client-side state significantly extends the capabilities of Web-based client/server applications.

    or

    1.1 What is a Cookie?

    A cookie is simply an HTTP header that consists of a text-only string that gets entered into the memory of a browser. This string contains the domain, path, lifetime, and value of a variable that a website sets. If the lifetime of this variable is longer than the time the user spends at that site, then this string is saved to file for future reference

    http://www.cookiecentral.com/faq/ <--- recommended!

    http://www.php.net/manual/en/function.setcookie.php http://home.netscape.com/newsref/std/cookie_spec.html

    attached mail follows:


    * Christopher Raymond [Fri, 17 Aug 2001 16:14:40 -0500]: > For example: I don't want users with browsers less than 4.0 to > actually load a page on our site. Instead, I want them redirected to a > page that let's them know their browser is in-compatible.

    Why do you want to do this? If a browser can't display your page because you use Java/Flash/whatever, it's not the user's browsers that is incompatible but your page design.

    Please take a look at the W3C's Web Accessibility Initiative, found under:

    http://www.w3.org/WAI/

    Regards Lutz

    -- 
    ** Please read these useful resources. **
    Java Anon Proxy: http://anon.inf.tu-dresden.de/
    Attribution FAQ: http://www.math.fu-berlin.de/~guckes/faq/attribution.html
    Signature FAQ:   http://www.math.fu-berlin.de/~guckes/message/sig.etiquette.html
    

    attached mail follows:


    Why not use something easier like phpSniff.

    http://phpsniff.sourceforge.net/

    You don't need a browscap.ini or troubling around with get_browser();

    Elias Santiago

    "Christopher Raymond" <christopheroasisnetworks.com> wrote in message news:B7A2F36F.CD6%christopheroasisnetworks.com... > > PHP Folks: > > Does PHP provide some mechanism for browser detection & redirection or is > this something that Apache Directives can handle? > > For example: I don't want users with browsers less than 4.0 to actually load > a page on our site. Instead, I want them redirected to a page that let's > them know their browser is in-compatible. > > I know this is something JavaScript can do, but again that relies on the > browser. > > > Thanks for any help, > > Christopher Raymond >

    attached mail follows:


    hi. use only <? ?> at the end and first line to work better and not crowd.

    attached mail follows:


    hi. in large database with php,postgres and when in each time come many request , how do we implement transactions?? nafiseh.

    attached mail follows:


    I believe that'd be a question best suited for the PostgreSQL mailing lists, since its handled at the database level with "begin" and "commit".

    /* Chris Lambert, CTO - chriswhitecrown.net WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */

    ----- Original Message ----- From: nafiseh saberi <nsaberiiraninfocenter.net> To: <php-generallists.php.net> Sent: Sunday, August 19, 2001 4:24 AM Subject: [PHP] transaction

    | | hi. | in large database with php,postgres | and when in each time come many request , | how do we implement transactions?? | nafiseh. | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: php-general-unsubscribelists.php.net | For additional commands, e-mail: php-general-helplists.php.net | To contact the list administrators, e-mail: php-list-adminlists.php.net | | |

    attached mail follows:


    Nafiseh Saberi wrote: > > hi. > in large database with php,postgres > and when in each time come many request , > how do we implement transactions??

    > nafiseh.

    If you are wanting to run several queries in the one script though the one transaction - you'll need to send a begin(as a query) and execute it - then to the same connection send all your other queries as normal, and follow it up with a commit.

    attached mail follows:


    hi. why most of you , use mysql and not postgres? nafiseh.

    attached mail follows:


    MySQL is easier to use and faster to develop with for 90% of web applications. Sure, PostgreSQL has some huge advantages, but not everyone needs the same thing.

    /* Chris Lambert, CTO - chriswhitecrown.net WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */

    ----- Original Message ----- From: nafiseh saberi <nsaberiiraninfocenter.net> To: <php-generallists.php.net> Sent: Sunday, August 19, 2001 4:24 AM Subject: [PHP] mysql , postgres

    | | hi. | why most of you , use mysql and not | postgres? | nafiseh. | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: php-general-unsubscribelists.php.net | For additional commands, e-mail: php-general-helplists.php.net | To contact the list administrators, e-mail: php-list-adminlists.php.net | | |

    attached mail follows:


    What would you say the advantages were?

    other than just the fact the the postgres implementation of sql is more powerful (sub-selects etc).

    I'ld be very interested to see some performance comparisions if anyone has any ----- Original Message ----- From: "Chris Lambert" <chrisphp.net> To: <php-generallists.php.net> Sent: Sunday, August 19, 2001 10:21 AM Subject: Re: [PHP] mysql , postgres

    > MySQL is easier to use and faster to develop with for 90% of web > applications. Sure, PostgreSQL has some huge advantages, but not everyone > needs the same thing. > > /* Chris Lambert, CTO - chriswhitecrown.net > WhiteCrown Networks - More Than White Hats > Web Application Security - www.whitecrown.net > */ > > ----- Original Message ----- > From: nafiseh saberi <nsaberiiraninfocenter.net> > To: <php-generallists.php.net> > Sent: Sunday, August 19, 2001 4:24 AM > Subject: [PHP] mysql , postgres > > > | > | hi. > | why most of you , use mysql and not > | postgres? > | nafiseh. > | > | -- > | PHP General Mailing List (http://www.php.net/) > | To unsubscribe, e-mail: php-general-unsubscribelists.php.net > | For additional commands, e-mail: php-general-helplists.php.net > | To contact the list administrators, e-mail: php-list-adminlists.php.net > | > | > | > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    attached mail follows:


    Rules, triggers, subselects, built in transactions, etc.

    I haven't used it myself, but it does have features which relieve a lot of the client programming (PHP) required with MySQL.

    /* Chris Lambert, CTO - chriswhitecrown.net WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */

    ----- Original Message ----- From: Tom Carter <subsroundcorners.com> To: Chris Lambert <chrisphp.net>; <php-generallists.php.net> Sent: Sunday, August 19, 2001 5:41 AM Subject: Re: [PHP] mysql , postgres

    | What would you say the advantages were? | | other than just the fact the the postgres implementation of sql is more | powerful (sub-selects etc). | | I'ld be very interested to see some performance comparisions if anyone has | any | ----- Original Message ----- | From: "Chris Lambert" <chrisphp.net> | To: <php-generallists.php.net> | Sent: Sunday, August 19, 2001 10:21 AM | Subject: Re: [PHP] mysql , postgres | | | > MySQL is easier to use and faster to develop with for 90% of web | > applications. Sure, PostgreSQL has some huge advantages, but not everyone | > needs the same thing. | > | > /* Chris Lambert, CTO - chriswhitecrown.net | > WhiteCrown Networks - More Than White Hats | > Web Application Security - www.whitecrown.net | > */ | > | > ----- Original Message ----- | > From: nafiseh saberi <nsaberiiraninfocenter.net> | > To: <php-generallists.php.net> | > Sent: Sunday, August 19, 2001 4:24 AM | > Subject: [PHP] mysql , postgres | > | > | > | | > | hi. | > | why most of you , use mysql and not | > | postgres? | > | nafiseh. | > | | > | -- | > | PHP General Mailing List (http://www.php.net/) | > | To unsubscribe, e-mail: php-general-unsubscribelists.php.net | > | For additional commands, e-mail: php-general-helplists.php.net | > | To contact the list administrators, e-mail: php-list-adminlists.php.net | > | | > | | > | | > | > | > -- | > PHP General Mailing List (http://www.php.net/) | > To unsubscribe, e-mail: php-general-unsubscribelists.php.net | > For additional commands, e-mail: php-general-helplists.php.net | > To contact the list administrators, e-mail: php-list-adminlists.php.net | > | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: php-general-unsubscribelists.php.net | For additional commands, e-mail: php-general-helplists.php.net | To contact the list administrators, e-mail: php-list-adminlists.php.net | | |

    attached mail follows:


    Chris Lambert wrote: > > MySQL is easier to use and faster to develop with for 90% of web > applications. Sure, PostgreSQL has some huge advantages, but not everyone > needs the same thing.

    easier to use ? I'm not sure why anyone would say that faster to develop ? nope - I find postgresql quicker to develop with, I can use triggers to cut out a whole heap of extra php code. MYsql lacks subselects which forces you to do extra code, it lacks true foreign keys which means you need to add extra code to check data integrity.

    People use MYSql because it's so widely available, just like people use Windows.

    > > /* Chris Lambert, CTO - chriswhitecrown.net > WhiteCrown Networks - More Than White Hats > Web Application Security - www.whitecrown.net > */ >

    > | > |

    attached mail follows:


    Tom Carter wrote: > > What would you say the advantages were? > Well just my opinion but I think that Postgresql development is advancing quicker. With Red Hat joining in development and no infighting bewteen Postgresql developers things are looking good for the future.

    > other than just the fact the the postgres implementation of sql is more > powerful (sub-selects etc).

    Foreign keys, triggers both make life a lot easier. Also once your used to Postgresql, moving onto Sybase, Interbase etc isn't near as hard as making the jump from MYsql.

    > > I'ld be very interested to see some performance comparisions if anyone has > any

    Dig around greatbridge.org and you might find some.

    > ----- Original Message ----- > From: "Chris Lambert" <chrisphp.net> > To: <php-generallists.php.net> > Sent: Sunday, August 19, 2001 10:21 AM > Subject: Re: [PHP] mysql , postgres > > > MySQL is easier to use and faster to develop with for 90% of web > > applications. Sure, PostgreSQL has some huge advantages, but not everyone > > needs the same thing. > > > > /* Chris Lambert, CTO - chriswhitecrown.net > > WhiteCrown Networks - More Than White Hats > > Web Application Security - www.whitecrown.net > > */ > > > > ----- Original Message ----- > > From: nafiseh saberi <nsaberiiraninfocenter.net> > > To: <php-generallists.php.net> > > Sent: Sunday, August 19, 2001 4:24 AM > > Subject: [PHP] mysql , postgres > > > > > > | > > | hi. > > | why most of you , use mysql and not > > | postgres? > > | nafiseh. > > | > > | -- > > | PHP General Mailing List (http://www.php.net/) > > | To unsubscribe, e-mail: php-general-unsubscribelists.php.net > > | For additional commands, e-mail: php-general-helplists.php.net > > | To contact the list administrators, e-mail: php-list-adminlists.php.net > > | > > | > > | > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > > For additional commands, e-mail: php-general-helplists.php.net > > To contact the list administrators, e-mail: php-list-adminlists.php.net > >

    attached mail follows:


    > Chris Lambert wrote: > > > > MySQL is easier to use and faster to develop with for 90% of web > > applications. Sure, PostgreSQL has some huge advantages, but not everyone > > needs the same thing. > > easier to use ? I'm not sure why anyone would say that > faster to develop ? nope - I find postgresql quicker to develop with, I > can use triggers to cut out a whole heap of extra php code. > MYsql lacks subselects which forces you to do extra code, it lacks true > foreign keys which means you need to add extra code to check data > integrity. > > People use MYSql because it's so widely available, just like people use > Windows.

    I would definately agree with the points about psotgresql having better functionallity, but it doesn't solely come down to availablility.

    MySQL is a simpler RDBMS.. this doesn't mean it is strictly "worse" than postgresql. In comes to one of those fundamental questions in IT... best tool for the job. What MySQl is good at is handling small (in both byte and row sense) tables which are frequently accessed, eg user authenitcatino. At the other extreme are the big boys of DB2, Oracle etc which can handle an awful lot and cope which much more complex structures and heavy usage. postgresql, IMHO, is a few steps from the MySQL extreme towards DB2. What I basically mean is that postgre has some features and functionallity which make it more suited to some tasks, and mysql has a place too.

    > > > > > > /* Chris Lambert, CTO - chriswhitecrown.net > > WhiteCrown Networks - More Than White Hats > > Web Application Security - www.whitecrown.net > > */ > > > > > | > > | > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    attached mail follows:


    Hi,

    > Well just my opinion but I think that Postgresql development is > advancing quicker. With Red Hat joining in development and no > infighting bewteen Postgresql developers things are looking > good for the future.

    just to clear one issue - there has never been a "fight between mysql developers".

    the thing you're probably referring to above is the MySQL-vs-NuSphere fight. NuSphere was to add their Gemini table handler (MySQL has an abstraction table handler layer, so you can add many different table handlers) to MySQL. it has not and won't affect the general development of MySQL.

    Rgds, Indrek

    --
    For technical support contracts, goto https://order.mysql.com/
       __  ___     ___ ____  __
      /  |/  /_ __/ __/ __ \/ /    Indrek Siitan <tfrmysql.com>
     / /|_/ / // /\ \/ /_/ / /__   MySQL AB, The Web Guru
    /_/  /_/\_, /___/\___\_\___/   Tallinn, Estonia
           <___/   www.mysql.com
    

    attached mail follows:


    Indrek Siitan wrote: > > Hi, > > > Well just my opinion but I think that Postgresql development is > > advancing quicker. With Red Hat joining in development and no > > infighting bewteen Postgresql developers things are looking > > good for the future. > > just to clear one issue - there has never been a "fight between mysql > developers". > > the thing you're probably referring to above is the MySQL-vs-NuSphere fight. > NuSphere was to add their Gemini table handler (MySQL has an abstraction table > handler layer, so you can add many different table handlers) to MySQL. it has > not and won't affect the general development of MySQL. > > Rgds, > Indrek > fair enough - slip of the tongue there

    but it does highlight the differences in in development style between MYsql and Postgresql.

    > For technical support contracts, goto https://order.mysql.com/ > __ ___ ___ ____ __ > / |/ /_ __/ __/ __ \/ / Indrek Siitan <tfrmysql.com> > / /|_/ / // /\ \/ /_/ / /__ MySQL AB, The Web Guru > /_/ /_/\_, /___/\___\_\___/ Tallinn, Estonia > <___/ www.mysql.com

    attached mail follows:


    Andrew/All,

    Following on from this I am interested to find out some performance comparisons/opinions of storing files in a db vs. storing in the file system and being redirected by php

    I think I've heard from elsewhere that file system is more effecient.

    The sistuation.... storing is pretty much a "one-off" activity, but accesses will be frequent. Files are small, ranging from 30k to 250k.

    Anyone have any comments/benchmarks? My attempts at testing the two have been sloppy to say the least.

    TIA, Tom ----- Original Message ----- From: "Andrew Libby" <alibbycommnav.com> To: "David Ovens" <DOvensdoweb.co.uk> Cc: <php-generallists.php.net> Sent: Sunday, August 19, 2001 3:20 AM Subject: Re: [PHP] MySql or flat database using PHP ?

    > > Dave, > IMHO, a major consideration for Web apps is contention and s > synchronization. If you intend to allow users to update > data on in the app it becomes important to coordinate writes > (with locking) so that no two users can write to the same (region) > of the file at the same time. An RDBMS (MySQL, PostgreSQL) or a directory > (OpenLDAP) takes care of this (as well as many other problems > with data storage and retrieval). I agree with the other statements I've > seen here, but wanted to add this as well. I've done it both ways > and the DBMS, Directory route tends to be a better solution. This is > code reuse of the best kind. > > My humble $0.02. > > Andy > > > On Sat, Aug 18, 2001 at 09:29:56PM +0100, David Ovens wrote: > > Before I start creating an Sql table/database, thought I would ask for advice first. > > > > I am creating a directory online, with urls information, links, email addresses etc etc. What do you think is best a MySql database or writing it to a file using fopen/fwrite (flat file) ??? Your thoughts would be very much appreciated. > > > > > > Thanks > > > > Dave > > > > > > > > -- > -------------------------------------------------- > Andrew Libby > Director of Technology > CommNav, Inc > alibbycommnav.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    attached mail follows:


    There was a long discussion on this in a java forum I am part of, the product of which was basically this...

    1. All variables in a class are best left to be private (not sure PHP has this, but the programmer can work the principle in mind.. that is only the class can access them). 2. Generic variable access/store methods should be avoided - the principle is that the internal variable can change name etc. without the external interface having to worry about it. 3. Method to set/fetch each variable - it may seem a counter intuitive way of doing it, especially when it is possible to do something "nice" like the set method below. This seems a very "un-web" way.. and this is where a difference comes in. Web is not inherently OO, and a lot of the practices of web programmers are at conflict with more "traditional" apps programmers. Web tends to go for speed and simplicity, rather than good design etc. 4. Some situations could theoretically arise where it is necessary to set an unknown amount of variables within a class, however it would be far more sensible to put these into an array.

    In summary, in good OOP you should have a method for every get/set operation on variables that is required, using arrays as appropiate.

    Going back to the original point on whether or not to access the variable directly or build a set function in, they are both as bad as each other, just about. They both access variables directly and require the outside program to have knowledge of variable names etc. and it doesn't allow for checking for "correct" values being set ( a useful thin with the above method)

    Hope this helps, let me know if I can provide any more advice.

    Tom

    ----- Original Message ----- From: "Andrew Libby" <alibbycommnav.com> To: "Joe Sheble (Wizaerd)" <JustForMailingListswizaerd.com> Cc: "General PHP List" <php-generallists.php.net> Sent: Sunday, August 19, 2001 3:34 AM Subject: Re: [PHP] class variables and methods

    > Joe, > There are varying opinions on this issue. The argument for > methods is that it hides the internal structure of your class. This > is always a good thing. This means that the internals of the class > can be changed, but the user interface (the user is the programmer here) > does not change. So this alternative implementation of someclass > > > class someclass

    > var $data = false; > > function set($key,$val) { > $this->data[$key] = $val; > } > } > > is no different the the calling code. In general, I tend to have an > accessor/mutator method for each 'property' that I would like to > provide access to. I'd have a method for each $key that I want to > support (this may not apply in your case). > > class someclass

    > var $name = false; > var $age = false; > > function name()

    > if(func_num_args()) $this->name = func_get_arg(0); > return $this->name; > } > > function age()

    > if(func_num_args()) $this->age= func_get_arg(0); > return $this->age; > } > } > > Now, this gets a big annoying to code since the lions share of my > classes have the name method implementations. I've been hunting > for a way to create methods dynamically, but I've only found one. > To create class definitions on the fly and eval() them. This > works great when you've got a huge number of properties > (class/instance vars). I'll construct a static method on the > class that processes examines the class vars (get_class_vars()) > and defines a class extending my implementation. The > sub class has the methods implemented for accessing/mutating > the properties I'd like to have methods for. If anyone knows > of a means to do this to an existing class (say using create_function() > or something), I'd love to hear about it. > > Andy > > > On Sat, Aug 18, 2001 at 07:09:08PM -0700, Joe Sheble (Wizaerd) wrote: > > I've been doing some reading up on OOP in PHP, and looking at some of the > > classes available on the web, and I've got what is probably a stupid > > question. I've seen this many many times.. > > > > class someclass { > > var $somevar = "someval"; > > > > function set( $key, $val ) { > > $this->$key = $val; > > } > > } > > > > $myClass = new someclass; > > $myClass->set( "somevar", "someotherval" ); > > > > why write a set method when you can just as easily call > > $myClass->somevar = "someotherval"; > > > > Is there a reason for this? > > > > Also, alot of the different table classes (an OOP approach to HTML tables) > > stores the data in arrays, but at what point is it too much to store into an > > array? Say you have a forum and the text entered for a single respone could > > be quite lengthy, much less for 100 replies... wouldn't that be a bit much > > to store into an array? I know it depends on the system resources, but is > > there a practical limit that people follow? > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > > For additional commands, e-mail: php-general-helplists.php.net > > To contact the list administrators, e-mail: php-list-adminlists.php.net > > > > -- > -------------------------------------------------- > Andrew Libby > Director of Technology > CommNav, Inc > alibbycommnav.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    attached mail follows:


    But when designing classes, isn't it normal to have private and public variables or properties. Granted my OOP experience is very limited, having access to OOP development in CA-Visual Objects, Clipper, VB, and ASP. But it was normal to have a series of public properties one could access directly and then properties that could only be access by the class itself. Of course in VB and ASP these were defined with Get, Let and Set methods, but you could still access them directly. You could also design properties that were read only as well. Perhaps this is because of operator overloading??

    > -----Original Message----- > From: Tom Carter [mailto:subsroundcorners.com] > Sent: Sunday, August 19, 2001 2:19 AM > To: Andrew Libby; Joe Sheble (Wizaerd) > Cc: General PHP List > Subject: Re: [PHP] class variables and methods > > > There was a long discussion on this in a java forum I am part of, the > product of which was basically this... > > 1. All variables in a class are best left to be private (not sure PHP has > this, but the programmer can work the principle in mind.. that is only the > class can access them). > 2. Generic variable access/store methods should be avoided - the principle > is that the internal variable can change name etc. without the external > interface having to worry about it. > 3. Method to set/fetch each variable - it may seem a counter intuitive way > of doing it, especially when it is possible to do something > "nice" like the > set method below. This seems a very "un-web" way.. and this is where a > difference comes in. Web is not inherently OO, and a lot of the > practices of > web programmers are at conflict with more "traditional" apps programmers. > Web tends to go for speed and simplicity, rather than good design etc. > 4. Some situations could theoretically arise where it is > necessary to set an > unknown amount of variables within a class, however it would be far more > sensible to put these into an array. > > In summary, in good OOP you should have a method for every > get/set operation > on variables that is required, using arrays as appropiate. > > Going back to the original point on whether or not to access the variable > directly or build a set function in, they are both as bad as each other, > just about. They both access variables directly and require the outside > program to have knowledge of variable names etc. and it doesn't allow for > checking for "correct" values being set ( a useful thin with the above > method) > > Hope this helps, let me know if I can provide any more advice. > > Tom > > ----- Original Message ----- > From: "Andrew Libby" <alibbycommnav.com> > To: "Joe Sheble (Wizaerd)" <JustForMailingListswizaerd.com> > Cc: "General PHP List" <php-generallists.php.net> > Sent: Sunday, August 19, 2001 3:34 AM > Subject: Re: [PHP] class variables and methods > > > > Joe, > > There are varying opinions on this issue. The argument for > > methods is that it hides the internal structure of your class. This > > is always a good thing. This means that the internals of the class > > can be changed, but the user interface (the user is the programmer here) > > does not change. So this alternative implementation of someclass > > > > > > class someclass > > > var $data = false; > > > > function set($key,$val) { > > $this->data[$key] = $val; > > } > > } > > > > is no different the the calling code. In general, I tend to have an > > accessor/mutator method for each 'property' that I would like to > > provide access to. I'd have a method for each $key that I want to > > support (this may not apply in your case). > > > > class someclass > > > var $name = false; > > var $age = false; > > > > function name() > > > if(func_num_args()) $this->name = func_get_arg(0); > > return $this->name; > > } > > > > function age() > > > if(func_num_args()) $this->age= func_get_arg(0); > > return $this->age; > > } > > } > > > > Now, this gets a big annoying to code since the lions share of my > > classes have the name method implementations. I've been hunting > > for a way to create methods dynamically, but I've only found one. > > To create class definitions on the fly and eval() them. This > > works great when you've got a huge number of properties > > (class/instance vars). I'll construct a static method on the > > class that processes examines the class vars (get_class_vars()) > > and defines a class extending my implementation. The > > sub class has the methods implemented for accessing/mutating > > the properties I'd like to have methods for. If anyone knows > > of a means to do this to an existing class (say using create_function() > > or something), I'd love to hear about it. > > > > Andy > > > > > > On Sat, Aug 18, 2001 at 07:09:08PM -0700, Joe Sheble (Wizaerd) wrote: > > > I've been doing some reading up on OOP in PHP, and looking at some of > the > > > classes available on the web, and I've got what is probably a stupid > > > question. I've seen this many many times.. > > > > > > class someclass { > > > var $somevar = "someval"; > > > > > > function set( $key, $val ) { > > > $this->$key = $val; > > > } > > > } > > > > > > $myClass = new someclass; > > > $myClass->set( "somevar", "someotherval" ); > > > > > > why write a set method when you can just as easily call > > > $myClass->somevar = "someotherval"; > > > > > > Is there a reason for this? > > > > > > Also, alot of the different table classes (an OOP approach to HTML > tables) > > > stores the data in arrays, but at what point is it too much to store > into an > > > array? Say you have a forum and the text entered for a single respone > could > > > be quite lengthy, much less for 100 replies... wouldn't that be a bit > much > > > to store into an array? I know it depends on the system > resources, but > is > > > there a practical limit that people follow? > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > > > For additional commands, e-mail: php-general-helplists.php.net > > > To contact the list administrators, e-mail: > php-list-adminlists.php.net > > > > > > > -- > > -------------------------------------------------- > > Andrew Libby > > Director of Technology > > CommNav, Inc > > alibbycommnav.com > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > > For additional commands, e-mail: php-general-helplists.php.net > > To contact the list administrators, e-mail: php-list-adminlists.php.net > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net > > >

    attached mail follows:


    There is a distinct chance of many difference schools of thought... my background is Java (mostly at IBM.. so of course could be very different).. but all the java gurus I've known have worked on the principle private variable and public methods.. declaring all variables (except constants.. php doesn't really have a comparably concept) as private and always using methods.

    I would be very interested to hear others opinion on this...

    > > But when designing classes, isn't it normal to have private and public > variables or properties. Granted my OOP experience is very limited, having > access to OOP development in CA-Visual Objects, Clipper, VB, and ASP. But > it was normal to have a series of public properties one could access > directly and then properties that could only be access by the class itself. > Of course in VB and ASP these were defined with Get, Let and Set methods, > but you could still access them directly. You could also design properties > that were read only as well. Perhaps this is because of operator > overloading?? > > > -----Original Message----- > > From: Tom Carter [mailto:subsroundcorners.com] > > Sent: Sunday, August 19, 2001 2:19 AM > > To: Andrew Libby; Joe Sheble (Wizaerd) > > Cc: General PHP List > > Subject: Re: [PHP] class variables and methods > > > > > > There was a long discussion on this in a java forum I am part of, the > > product of which was basically this... > > > > 1. All variables in a class are best left to be private (not sure PHP has > > this, but the programmer can work the principle in mind.. that is only the > > class can access them). > > 2. Generic variable access/store methods should be avoided - the principle > > is that the internal variable can change name etc. without the external > > interface having to worry about it. > > 3. Method to set/fetch each variable - it may seem a counter intuitive way > > of doing it, especially when it is possible to do something > > "nice" like the > > set method below. This seems a very "un-web" way.. and this is where a > > difference comes in. Web is not inherently OO, and a lot of the > > practices of > > web programmers are at conflict with more "traditional" apps programmers. > > Web tends to go for speed and simplicity, rather than good design etc. > > 4. Some situations could theoretically arise where it is > > necessary to set an > > unknown amount of variables within a class, however it would be far more > > sensible to put these into an array. > > > > In summary, in good OOP you should have a method for every > > get/set operation > > on variables that is required, using arrays as appropiate. > > > > Going back to the original point on whether or not to access the variable > > directly or build a set function in, they are both as bad as each other, > > just about. They both access variables directly and require the outside > > program to have knowledge of variable names etc. and it doesn't allow for > > checking for "correct" values being set ( a useful thin with the above > > method) > > > > Hope this helps, let me know if I can provide any more advice. > > > > Tom > > > > ----- Original Message ----- > > From: "Andrew Libby" <alibbycommnav.com> > > To: "Joe Sheble (Wizaerd)" <JustForMailingListswizaerd.com> > > Cc: "General PHP List" <php-generallists.php.net> > > Sent: Sunday, August 19, 2001 3:34 AM > > Subject: Re: [PHP] class variables and methods > > > > > > > Joe, > > > There are varying opinions on this issue. The argument for > > > methods is that it hides the internal structure of your class. This > > > is always a good thing. This means that the internals of the class > > > can be changed, but the user interface (the user is the programmer here) > > > does not change. So this alternative implementation of someclass > > > > > > > > > class someclass > > > > > var $data = false; > > > > > > function set($key,$val) { > > > $this->data[$key] = $val; > > > } > > > } > > > > > > is no different the the calling code. In general, I tend to have an > > > accessor/mutator method for each 'property' that I would like to > > > provide access to. I'd have a method for each $key that I want to > > > support (this may not apply in your case). > > > > > > class someclass > > > > > var $name = false; > > > var $age = false; > > > > > > function name() > > > > > if(func_num_args()) $this->name = func_get_arg(0); > > > return $this->name; > > > } > > > > > > function age() > > > > > if(func_num_args()) $this->age= func_get_arg(0); > > > return $this->age; > > > } > > > } > > > > > > Now, this gets a big annoying to code since the lions share of my > > > classes have the name method implementations. I've been hunting > > > for a way to create methods dynamically, but I've only found one. > > > To create class definitions on the fly and eval() them. This > > > works great when you've got a huge number of properties > > > (class/instance vars). I'll construct a static method on the > > > class that processes examines the class vars (get_class_vars()) > > > and defines a class extending my implementation. The > > > sub class has the methods implemented for accessing/mutating > > > the properties I'd like to have methods for. If anyone knows > > > of a means to do this to an existing class (say using create_function() > > > or something), I'd love to hear about it. > > > > > > Andy > > > > > > > > > On Sat, Aug 18, 2001 at 07:09:08PM -0700, Joe Sheble (Wizaerd) wrote: > > > > I've been doing some reading up on OOP in PHP, and looking at some of > > the > > > > classes available on the web, and I've got what is probably a stupid > > > > question. I've seen this many many times.. > > > > > > > > class someclass { > > > > var $somevar = "someval"; > > > > > > > > function set( $key, $val ) { > > > > $this->$key = $val; > > > > } > > > > } > > > > > > > > $myClass = new someclass; > > > > $myClass->set( "somevar", "someotherval" ); > > > > > > > > why write a set method when you can just as easily call > > > > $myClass->somevar = "someotherval"; > > > > > > > > Is there a reason for this? > > > > > > > > Also, alot of the different table classes (an OOP approach to HTML > > tables) > > > > stores the data in arrays, but at what point is it too much to store > > into an > > > > array? Say you have a forum and the text entered for a single respone > > could > > > > be quite lengthy, much less for 100 replies... wouldn't that be a bit > > much > > > > to store into an array? I know it depends on the system > > resources, but > > is > > > > there a practical limit that people follow? > > > > > > > > > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > > > > For additional commands, e-mail: php-general-helplists.php.net > > > > To contact the list administrators, e-mail: > > php-list-adminlists.php.net > > > > > > > > > > -- > > > -------------------------------------------------- > > > Andrew Libby > > > Director of Technology > > > CommNav, Inc > > > alibbycommnav.com > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > > > For additional commands, e-mail: php-general-helplists.php.net > > > To contact the list administrators, e-mail: php-list-adminlists.php.net > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > > For additional commands, e-mail: php-general-helplists.php.net > > To contact the list administrators, e-mail: php-list-adminlists.php.net > > > > > > >

    attached mail follows:


    Hi,

    Who can help me with the following problem? I have the tables score and totalscore.

    Score: id userid name score

    Totalscore: userid name totalscore

    In the table score one user can have mutiple scores. But in totalscore the userid is unique. Now I want to count all the score's of a user en place this at the same user in totalscore.

    Example of score: 1 1 Martin 10 2 2 John 5 3 3 Richard 12 4 1 Martin 3 5 3 Richard 8 6 1 Martin 7 7 2 John 15

    So I would like to know the total score of each user. But I don't know how to do this. Who can help me out?

    Cheers, Martin.

    attached mail follows:


    Assuming MySQL... <? $score = mysql_query("SELECT SUM(score), userid, name FROM score_table GROUP BY userid"); mysql_query("DELETE FROM totalscore_table"); while (list($score, $userid, $name) = mysql_fetch_array($scores)) mysql_query("INSERT INTO totalscore_table (userid, name, totalscore) VALUES ('$userid', '$name', '".addslashes($totalscore)."')"); ?>

    /* Chris Lambert, CTO - chriswhitecrown.net WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */

    ----- Original Message ----- From: Martin Kampherbeek <m.kampherbeekhome.nl> To: <php-generallists.php.net> Sent: Sunday, August 19, 2001 5:34 AM Subject: [PHP] Count total

    Hi,

    Who can help me with the following problem? I have the tables score and totalscore.

    Score: id userid name score

    Totalscore: userid name totalscore

    In the table score one user can have mutiple scores. But in totalscore the userid is unique. Now I want to count all the score's of a user en place this at the same user in totalscore.

    Example of score: 1 1 Martin 10 2 2 John 5 3 3 Richard 12 4 1 Martin 3 5 3 Richard 8 6 1 Martin 7 7 2 John 15

    So I would like to know the total score of each user. But I don't know how to do this. Who can help me out?

    Cheers, Martin.

    attached mail follows:


    On Sun, 19 Aug 2001, Martin Kampherbeek wrote:

    > Hi, > > Who can help me with the following problem? > I have the tables score and totalscore. > > Score: > id > userid > name > score > > Totalscore: > userid > name > totalscore > > In the table score one user can have mutiple scores. But in totalscore > the userid is unique. Now I want to count all the score's of a user en > place this at the same user in totalscore. > > Example of score: > 1 1 Martin 10 > 2 2 John 5 > 3 3 Richard 12 > 4 1 Martin 3 > 5 3 Richard 8 > 6 1 Martin 7 > 7 2 John 15 > > So I would like to know the total score of each user. > But I don't know how to do this. Who can help me out?

    insert into totalscores (userid,name,totalscore) select userid, name, sum(score) as totalscore from scores group by userid;

    -Rasmus

    attached mail follows:


    Ive read through the PEAR coding standards but was wondering about a few things not talked about in them -

    - Is declaring all variables a good idea - so theres no unassigned variables hanging around ? (no warnings produced when error reporting set to E_ALL) - Naming of include files - .inc or .php ? - naming of class files .inc or .php ?

    I know these have no big effect on the actual scripts themselves - but was wondering what people consider "good practice" to be.

    attached mail follows:


    Hi!

    I'm having some problem assigning a custom function ({math}) a value of a {section} block. I've got a section where I want to do some easy math. But somehow I'm stuck....

    Here's my template:

    <html><head><title>Section Test</title></title></head><body bgcolor=white>

    {section name=people loop=$FirstName} {$FirstName[people]} {$LastName[people]} {math equation="x + y" x="{$FirstName[people]}" y="{$LastName[people]}"}<br> {/section}

    </body></html>

    The PHP code:

    <?php require_once 'Smarty.class.php'; $smarty = new Smarty();

    $x = array(1, 2, 3, 4, 5);

    $y = array(9, 8, 7, 6, 5);

    $smarty->assign("FirstName", $y); $smarty->assign("LastName", $x);

    $smarty->display("test.tpl"); ?>

    When I run this, I get the following errormessage in my browser:

    Parse error: parse error, expecting `'}'' in /home/askwar/public_html/olg/html/templates_c/test.tpl.php on line 65

    Line 65:

    <?php smarty_func_math(array('equation' => "x + y",'x' => "{$FirstName[people]"), $this); if($this->_extract) { extract($this->_tpl_vars); $this->_extract=false; } ?>" y="<?php echo $this->_tpl_vars['LastName'][$this->_sections['people']['properties']['index']] ;?>

    Also removing the { and } at the x= and y= section in my template doesn't work. The section now looks like this:

    {section name=people loop=$FirstName} {%people.rownum%} {$FirstName[people]} {$LastName[people]} {math equation="x + y" x="$FirstName[people]" y="$LastName[people]"}<br> {/section}

    Now I get 5 lines in my browser, but also a different error message:

    1 9 1 Warning: Smarty error: math: parameter x is empty in /home/askwar/public_html/olg/html/OliG-System/smarty/Smarty.class.php on line 1090

    The first "1 9 1" is correct. It's the row number and the values of x and y.

    How can I do this?

    Thanks a lot!

    Alexander Skwar

    -- 
    How to quote:	http://learn.to/quote (german) http://quote.6x.to (english)
    Homepage:	http://www.digitalprojects.com   |   http://www.iso-top.de
       iso-top.de - Die günstige Art an Linux Distributionen zu kommen
    		Uptime: 1 day 12 hours 10 minutes
    

    attached mail follows:


    hi.

    I write it with php to relationship with databasein database server (with postgres). to update on field of one special row.

    $up = pg_exec($conn,"update personel set exit_m ='now' where name= '$ID' and date='now' ");

    what is the error in it?? thanks.

    attached mail follows:


    "Nafiseh Saberi" <nsaberiiraninfocenter.net> wrote in message news:200108191409.f7JE9GF22572persia.iraninfocenter.net... > > I write it with php to relationship with databasein database server > (with postgres). > to update on field of one special row. > > $up = pg_exec($conn,"update personel set exit_m ='now' where > name= '$ID' and date='now' ");

    Isn't 'now' as function, ie should be 'now()'?

    attached mail follows:


    my problem solved, because of not match in {}.

    thanks.

    attached mail follows:


    This is thew sort of thing I want:

    SELECT * FROM table ORDER BY substr(field,5,6)

    but I don't know the correct function, if there is one, or how to implement it.

    cheers,

    - seb

    -----Original Message----- From: Michael [mailto:mwapleswaples.net] Sent: 19 August 2001 12:51 To: php-generallists.php.net Subject: [PHP] Re: transaction

    Nafiseh Saberi wrote: > > hi. > in large database with php,postgres > and when in each time come many request , > how do we implement transactions??

    > nafiseh.

    If you are wanting to run several queries in the one script though the one transaction - you'll need to send a begin(as a query) and execute it - then to the same connection send all your other queries as normal, and follow it up with a commit.

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    You can achieve the same effect by using left and right ----- Original Message ----- From: "Seb Frost" <sebraceshoot.com> To: <php-generallists.php.net> Sent: Sunday, August 19, 2001 3:12 PM Subject: [PHP] MySQL substrings?

    > This is thew sort of thing I want: > > SELECT * FROM table ORDER BY substr(field,5,6) > > but I don't know the correct function, if there is one, or how to implement > it. > > cheers, > > - seb > > -----Original Message----- > From: Michael [mailto:mwapleswaples.net] > Sent: 19 August 2001 12:51 > To: php-generallists.php.net > Subject: [PHP] Re: transaction > > > Nafiseh Saberi wrote: > > > > hi. > > in large database with php,postgres > > and when in each time come many request , > > how do we implement transactions?? > > > nafiseh. > > If you are wanting to run several queries in the one script though the > one transaction - > you'll need to send a begin(as a query) and execute it - then to the > same connection send all your other queries as normal, and follow it up > with a commit. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    attached mail follows:


    There is a SUBSTRING() function, its just hard to find with their search system.

    /* Chris Lambert, CTO - chriswhitecrown.net WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */

    ----- Original Message ----- From: Tom Carter <subsroundcorners.com> To: Seb Frost <sebraceshoot.com>; <php-generallists.php.net> Sent: Sunday, August 19, 2001 10:32 AM Subject: Re: [PHP] MySQL substrings?

    | You can achieve the same effect by using left and right | ----- Original Message ----- | From: "Seb Frost" <sebraceshoot.com> | To: <php-generallists.php.net> | Sent: Sunday, August 19, 2001 3:12 PM | Subject: [PHP] MySQL substrings? | | | > This is thew sort of thing I want: | > | > SELECT * FROM table ORDER BY substr(field,5,6) | > | > but I don't know the correct function, if there is one, or how to | implement | > it. | > | > cheers, | > | > - seb | > | > -----Original Message----- | > From: Michael [mailto:mwapleswaples.net] | > Sent: 19 August 2001 12:51 | > To: php-generallists.php.net | > Subject: [PHP] Re: transaction | > | > | > Nafiseh Saberi wrote: | > > | > > hi. | > > in large database with php,postgres | > > and when in each time come many request , | > > how do we implement transactions?? | > | > > nafiseh. | > | > If you are wanting to run several queries in the one script though the | > one transaction - | > you'll need to send a begin(as a query) and execute it - then to the | > same connection send all your other queries as normal, and follow it up | > with a commit. | > | > -- | > PHP General Mailing List (http://www.php.net/) | > To unsubscribe, e-mail: php-general-unsubscribelists.php.net | > For additional commands, e-mail: php-general-helplists.php.net | > To contact the list administrators, e-mail: php-list-adminlists.php.net | > | > | > -- | > PHP General Mailing List (http://www.php.net/) | > To unsubscribe, e-mail: php-general-unsubscribelists.php.net | > For additional commands, e-mail: php-general-helplists.php.net | > To contact the list administrators, e-mail: php-list-adminlists.php.net | > | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: php-general-unsubscribelists.php.net | For additional commands, e-mail: php-general-helplists.php.net | To contact the list administrators, e-mail: php-list-adminlists.php.net | | |

    attached mail follows:


    very hard obviously.. I've looked quite a bit before to no avail! I tried guessing it, obviously stupidity prevailed

    (note to self.. go back and use substring function instead) ----- Original Message ----- From: "Chris Lambert" <chrisphp.net> To: <php-generallists.php.net> Sent: Sunday, August 19, 2001 3:48 PM Subject: Re: [PHP] MySQL substrings?

    > There is a SUBSTRING() function, its just hard to find with their search > system. > > /* Chris Lambert, CTO - chriswhitecrown.net > WhiteCrown Networks - More Than White Hats > Web Application Security - www.whitecrown.net > */ > > ----- Original Message ----- > From: Tom Carter <subsroundcorners.com> > To: Seb Frost <sebraceshoot.com>; <php-generallists.php.net> > Sent: Sunday, August 19, 2001 10:32 AM > Subject: Re: [PHP] MySQL substrings? > > > | You can achieve the same effect by using left and right > | ----- Original Message ----- > | From: "Seb Frost" <sebraceshoot.com> > | To: <php-generallists.php.net> > | Sent: Sunday, August 19, 2001 3:12 PM > | Subject: [PHP] MySQL substrings? > | > | > | > This is thew sort of thing I want: > | > > | > SELECT * FROM table ORDER BY substr(field,5,6) > | > > | > but I don't know the correct function, if there is one, or how to > | implement > | > it. > | > > | > cheers, > | > > | > - seb > | > > | > -----Original Message----- > | > From: Michael [mailto:mwapleswaples.net] > | > Sent: 19 August 2001 12:51 > | > To: php-generallists.php.net > | > Subject: [PHP] Re: transaction > | > > | > > | > Nafiseh Saberi wrote: > | > > > | > > hi. > | > > in large database with php,postgres > | > > and when in each time come many request , > | > > how do we implement transactions?? > | > > | > > nafiseh. > | > > | > If you are wanting to run several queries in the one script though the > | > one transaction - > | > you'll need to send a begin(as a query) and execute it - then to the > | > same connection send all your other queries as normal, and follow it up > | > with a commit. > | > > | > -- > | > PHP General Mailing List (http://www.php.net/) > | > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > | > For additional commands, e-mail: php-general-helplists.php.net > | > To contact the list administrators, e-mail: php-list-adminlists.php.net > | > > | > > | > -- > | > PHP General Mailing List (http://www.php.net/) > | > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > | > For additional commands, e-mail: php-general-helplists.php.net > | > To contact the list administrators, e-mail: php-list-adminlists.php.net > | > > | > | > | -- > | PHP General Mailing List (http://www.php.net/) > | To unsubscribe, e-mail: php-general-unsubscribelists.php.net > | For additional commands, e-mail: php-general-helplists.php.net > | To contact the list administrators, e-mail: php-list-adminlists.php.net > | > | > | > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    attached mail follows:


    This doesn't work:

    $result = mysql_query("SELECT * FROM $table ORDER BY SUBSTRING(date,5,2)")

    Any idea why?

    - seb

    attached mail follows:


    Hi,

    I am trying to post some form data to a php page that then updates a mysql database and echos back to the browser that the data has been inputted. Here is the general form of my post;-

    <form action="blah.php3" method="post">

    .. form widgets here .....

    <input type="submit" value="blahblah"> </form>

    this works perfectly with IE and opera, but with netscape 4.* it either takes ages for the event to transpire or times out. I am not trying to post any files ect, just text field data, 1k max, anyone have any ideas what is going wrong?

    thanks

    attached mail follows:


    I have the same problem, I'm curious to hear what people say about this....

    -----Message d'origine----- De : Ppb1.pair.com [mailto:Ppb1.pair.com] Envoyé : dimanche 19 août 2001 16:34 À : php-generallists.php.net Objet : [PHP] problems with a netscape post

    Hi,

    I am trying to post some form data to a php page that then updates a mysql database and echos back to the browser that the data has been inputted. Here is the general form of my post;-

    <form action="blah.php3" method="post">

    .. form widgets here .....

    <input type="submit" value="blahblah"> </form>

    this works perfectly with IE and opera, but with netscape 4.* it either takes ages for the event to transpire or times out. I am not trying to post any files ect, just text field data, 1k max, anyone have any ideas what is going wrong?

    thanks

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: php-general-unsubscribelists.php.net
    For additional commands, e-mail: php-general-helplists.php.net
    To contact the list administrators, e-mail: php-list-adminlists.php.net
    

    attached mail follows:


    Try giving the form a name?

    I normally use something like...

    <FORM NAME="myform" METHOD="post" ACTION="<?=$PHP_SELF?>">

    Any it works in NS 4+

    SL

    ----- Original Message ----- From: "Quentin Gillet" <phpleatel.com> To: <php-generallists.php.net> Sent: Sunday, August 19, 2001 10:06 AM Subject: RE: [PHP] problems with a netscape post

    > I have the same problem, I'm curious to hear what people say about this.... > > -----Message d'origine----- > De : Ppb1.pair.com [mailto:Ppb1.pair.com] > Envoyé : dimanche 19 août 2001 16:34 > À : php-generallists.php.net > Objet : [PHP] problems with a netscape post > > > Hi, > > I am trying to post some form data to a php page that then updates a > mysql database and echos back to the browser that the data has been > inputted. Here is the general form of my post;- > > <form action="blah.php3" method="post"> > > .. form widgets here ..... > > <input type="submit" value="blahblah"> > </form> > > this works perfectly with IE and opera, but with netscape 4.* it > either takes ages for the event to transpire or times out. I am not > trying to post any files ect, just text field data, 1k max, anyone > have any ideas what is going wrong? > > thanks > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribelists.php.net > For additional commands, e-mail: php-general-helplists.php.net > To contact the list administrators, e-mail: php-list-adminlists.php.net >

    attached mail follows:


    Hi all!

    How can I "logout" from a PHP based auth (with PHP_AUTH_USER and PHP_AUTH_PW and appropriate headers sent at the beginning)? It seems like unset($PHP_AUTH_USER) does not wotk in this case...

    Any help would be appreciated!

    Alex Sofronie maxxmail.dntis.ro

    attached mail follows:


    Hi,

    I'm on virtual hosting that lets me configure anything with .htaccess file. I was recomended by provider to specify location of sendmail in case I want to use php mail() function I know that I may do it in .htaccess file by adding php_value sendmail_path /usr/sbin/sendmail The qwestion is can I do anything else but correcting the path in .htaccess, this is the last thing I want to do.

    Youri <>< <>< <>< <>< God is our provider ><> ><> ><> ><> http://www.body-builders.org

    attached mail follows:


    Hi

    I'm getting strange errors if I add "LoadModule php4_module ../php/sapi/php4apache.dll" to http.conf If I don't load it everything is working with php.exe without any errors but as I load it as a modul I get for example - Warning: Undefined variable: page in d:\abria sql\apache\htdocs\inc\page.inc on line 2 here is the page.inc file: <?php  if (!$page): $page = 1; endif; $limit = ($page * 10) - 10; ?>

    What is wrong? I need php as a modul but what do I do wrong, I did everything according to install.txt in php directory.

    Thank you

    Youri

    <>< <>< <>< <>< God is our provider ><> ><> ><> ><> http://www.body-builders.org

    attached mail follows:


    I'm trying to include a .cgi using the virtual() function and then do a string replace on a string w/in the included page. The virtual seems to ignore the str_replace it just prints the virtual include w/out replacing the word "window" w/ the word "DOG" in my example. What am I doing wrong?

    <?

    $results = virtual("/cgi-bin/search.cgi?q=hello&m=world");

    print str_replace("window", "DOG", $results);

    ?>

    TIA,

    Charlie

    attached mail follows:


    A while ago, Vilius Benetis, an engineer from Lithuania created some great new SNMP functions for PHP 3 (snmp_getnext(), etc.)

    Well I've modified the code so that it will compile under PHP v4 now. (This is a replacement to the PHP source code, and not actually PHP Code)

    It can be found at: http://www.ncinter.net/~bert/php-snmp-v4.tar.gz

    Enjoy.

    Robert Schultz - bertncinter.net

    attached mail follows:


    Well, there's no explanation for it in the manual and I didn't find any by searching all relevant archives with deja. So, what does it EXACTLY do when I compile it in and are there configuration options for it? (f.i. the amount of memory to limit to ;-)

    Kai

    --
    

    Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com IE-Center: http://ie5.de & http://msie.winware.org ClubWin - Help for Windows Users: http://www.clubwin.com