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: Tue Oct 09 2001 - 19:19:25 CDT

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

    php-general Digest 10 Oct 2001 00:19:25 -0000 Issue 925

    Topics (messages 70451 through 70555):

    Form Validation
            70451 by: afrodriguez.att.net
            70452 by: Kamil Nowicki
            70454 by: Felix
            70478 by: Chris Hobbs

    MPP support in future PHP versions?
            70453 by: Martin Lindhe

    Re: recompile rpm with sablot -- zlib problems
            70455 by: thorsten maus

    Re: massive MySQL tables
            70456 by: Julio Nobrega Trabalhando
            70488 by: Alfredeen, Johan
            70493 by: Alfredeen, Johan

    how can i invoke php functions in my new extension?
            70457 by: ZhiQiang He

    Re: Undefined offset
            70458 by: Andrey Hristov
            70460 by: Andrey Hristov

    Re: Inserting variables
            70459 by: liljim
            70486 by: Wade Berlin
            70490 by: Andrey Hristov
            70545 by: Jason G.
            70548 by: Jason G.
            70549 by: PHPGalaxy.com

    echo warnings
            70461 by: Martin Lindhe
            70470 by: _lallous
            70504 by: Martin Lindhe

    Anyway of knowing whether a integer is odd or even
            70462 by: Sam
            70463 by: Dave Watkinson
            70464 by: Jason Brooke
            70465 by: Kamil Nowicki
            70466 by: ReDucTor
            70469 by: _lallous
            70482 by: Taylor, Stewart
            70483 by: Jack Dempsey
            70484 by: Taylor, Stewart
            70516 by: J Smith
            70518 by: David Otton
            70533 by: J Smith
            70534 by: Orr, Steve

    Re: nested includes()...
            70467 by: Tim Ward
            70522 by: Christian Dechery
            70523 by: Christian Dechery
            70524 by: Christian Dechery
            70530 by: anders nawroth
            70532 by: Christian Dechery
            70550 by: Jason G.

    access database on linux
            70468 by: AJDIN BRANDIC
            70477 by: Andrey Hristov
            70485 by: AJDIN BRANDIC
            70487 by: Andrey Hristov
            70489 by: Andrew Hill

    Re: Newlines in files
            70471 by: Blake Schwendiman

    Reference Numbers! Count Upwords !!!
            70472 by: Coenraad Steenkamp
            70480 by: Andrey Hristov

    [BUG?] substr giving strange results
            70473 by: Jean-Christian Imbeault
            70474 by: Dave Watkinson
            70475 by: Jack Dempsey
            70476 by: Jean-Christian Imbeault

    Re: debugging PHP scripts, is that possible?
            70479 by: Felix
            70481 by: Andrey Hristov

    Inserting variables (Revised)
            70491 by: RoyW
            70494 by: Kamil Nowicki
            70496 by: Kamil Nowicki
            70499 by: Chris Lee

    Re: Submitting variables via /'s
            70492 by: John A. Grant
            70503 by: JSheble
            70506 by: Chris Hobbs
            70508 by: John A. Grant
            70513 by: JSheble

    can anyone help me?
            70495 by: ZhiQiang He

    Re: JS refering to HTML/PHP arrays
            70497 by: Andrew Chase

    Re: using date as an "id" field...
            70498 by: Hidulf
            70525 by: Mark

    Re: not so happy with include()
            70500 by: Chris Lee

    Re: working with files
            70501 by: Chris Lee

    Question on Database
            70502 by: Viper1

    header() behavior
            70505 by: Martin Lindhe

    Re: GD Question
            70507 by: Sam Masiello

    Parsing received email
            70509 by: Boget, Chris
            70512 by: Philip Hallstrom
            70515 by: CC Zona
            70526 by: Richard Heyes
            70528 by: JSheble

    problem with locale
            70510 by: Paul Newby

    Inserting variables (Saga Continues)
            70511 by: RoyW
            70519 by: Kamil Nowicki
            70520 by: Kamil Nowicki
            70521 by: Steve Edberg

    quick question
            70514 by: Jeremy Morano
            70517 by: WebDev
            70537 by: Tom Carter

    Differentiate running from command line cf through web browser/server
            70527 by: DL Neil
            70529 by: Matthew Walker

    PHP Loop Timout
            70531 by: Ninety-Nine Ways To Die

    why isn't this regex working?
            70535 by: Boget, Chris
            70539 by: Jack Dempsey

    class and pictures from database
            70536 by: Mitja Pagon
            70547 by: Brian White

    Interbase and PHP
            70538 by: German Pablo Gentile

    Strange Problem with NS6.1
            70540 by: Jay Paulson

    Quotation Marks in <textarea>...</textarea>
            70541 by: KC
            70542 by: Jack Dempsey
            70555 by: Philip Olson

    Truncated Variables
            70543 by: Michael J Katz
            70552 by: Reuben D Budiardja
            70554 by: Jerry Lake

    ftp_rawlist
            70544 by: wloeffelholz.xh9.net
            70546 by: wloeffelholz.xh9.net
            70553 by: Evan Nemerson

    Re: executing a PHP (shell script) through PHP (module)
            70551 by: Evan Nemerson

    Administrivia:

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

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

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

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

    attached mail follows:


    I have a PHP script that displays a form. Before the
    user submits the data to the server, I would like to
    validate that all the responses were entered.

    I know how to do this within an HTML document (using
    JavaScript) but I don't know how to do it within a PHP
    script.

    Can someone please help?

    Thank you!

    Tony
    (afrodriguezatt.net)

    attached mail follows:


    > I have a PHP script that displays a form. Before the
    > user submits the data to the server, I would like to
    > validate that all the responses were entered.
    You can't do it BEFORE sending cause PHP gets it AFTER.
    You may validate it by PHP after posting, and if
    the data is not valid, display the error message instead
    using the data.
    You may also display the form again giving info about
    which fields are filled incorrect.

                                    Kamil 'Hilarion' Nowicki

    attached mail follows:


    Well you do not need any more assistance. Javascript is clientside therefore
    you should use it to validate any and all form item /s. PHP cannot interact
    with your broswer as it is a server side language interpreted on the host
    you're making the request to.

    Felix
    ----- Original Message -----
    From: <afrodriguezatt.net>
    To: <php-generallists.php.net>
    Sent: Tuesday, October 09, 2001 8:58 AM
    Subject: [PHP] Form Validation

    > I have a PHP script that displays a form. Before the
    > user submits the data to the server, I would like to
    > validate that all the responses were entered.
    >
    > I know how to do this within an HTML document (using
    > JavaScript) but I don't know how to do it within a PHP
    > script.
    >
    > Can someone please help?
    >
    > Thank you!
    >
    > Tony
    > (afrodriguezatt.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:


    Felix wrote:
    >
    > Well you do not need any more assistance. Javascript is clientside therefore
    > you should use it to validate any and all form item /s. PHP cannot interact
    > with your broswer as it is a server side language interpreted on the host
    > you're making the request to.

    But you must also validate it on the server side, or you're just begging
    someone to take advantage of some flaw in your program. _Never_ trust
    what the client sends back to the server!

    Chris

    attached mail follows:


    Is there anyone currently working on/planning to work on support for MPP
    (Mobile Positioning Protocol) to future versions of PHP?

    /Martin

    attached mail follows:


    Thorsten Maus wrote:

    > i try to rebuild the php4.0.4pl1-9 with sablot enabled...
    >
    > the following message occurs:
    >
    >
    > configure: error: Zlib module requires zlib >= 1.0.9.
    > Fehler: Bad exit status from /var/tmp/rpm-tmp.16852 (%build)
    >
    >
    > RPM build errors:
    > Bad exit status from /var/tmp/rpm-tmp.16852 (%build)
    >
    >
    > without the sablot flag compilation works fine....
    >
    > zlib is installed in version 1.1....
    >
    >
    > any ideas ???
    >

    then config.log file ends with

    configure:43858: gcc -o conftest -O2 -march=i386 -mcpu=i686 -fPIC -ggdb
      -DXML_BYTE_ORDER=12 -L/usr/lib conftest.c -lz -lxmltok -lxmlparse
    -lsablot -lttf -lz -lpng -lgd -ljpeg -ldb -ldb2 -lgdbm -lresolv -lm -ldl
    -lcrypt -lnsl -lttf -lpng -ljpeg -lz -lresolv -L/usr/lib -ljpeg 1>&5
    /usr/bin/ld: cannot find -lxmltok
    collect2: ld returned 1 exit status
    configure: failed program was:
    #line 43847 "configure"
    #include "confdefs.h"

    :o)

    attached mail follows:


      I have similar problems with 2 huge forms. The best thing I am doing is to
    divide among lots of Mysql tables. And follow a lot of performance hints
    from its manual.

      For example, separate variable length fields from those who are not (ie
    Varchar in a table, Int on another).

      And so it goes... Maybe if you are really concerned, store some data that
    will never change in files.... Non-dynamic data doesn't follow the database
    concept, does it?... :-)

    --
    

    Julio Nobrega

    A hora está chegando: http://toca.sourceforge.net "Justin French" <justinindent.com.au> wrote in message news:3BC22718.CF31EF78indent.com.au... > Hi all, > > Sorry for being slightly OT, but I'm working on a site with a large > application form (84 fields) which people have to fill in. The form is > rendering in the browser pretty quick (my first worry), but now I'm > concerned that 85+ data fields in MySQL might create performance > problems on the server. > > Is this likely? > > Most fields are "medium text" or "varchar", and will not need to be > searched at all, so i'll prolly just index the two or three important > ones, and leave it at that. > > > If there is likley to be a performance hit, what other options will I have? > > > Justin French

    attached mail follows:


    "Maybe if you are really concerned, store some data that will never change in files.... Non-dynamic data doesn't follow the database concept, does it?... :-)"

    Sure it does. Most enterprise databases also include static tables, in addition to dynamic tables. These are often known as Reference or Domain tables. Databases are great at indexing for fast searching of table rows. Stay away from large flat files.

    Speaking of which, I recommend that you (Jason) isolate any data that may be entered often, like when a user selects from possible values such as state names, and make these seperate domain tables. Then all you need to insert into your dynamic table is an integer ID associated with the actual value. Saves space and makes your db design more scalable and flexible.

    Johan

    -----Original Message----- From: Julio Nobrega Trabalhando [mailto:inerteARROBAhotmail.compb1.pair.com] Sent: Tuesday, October 09, 2001 6:37 AM To: php-generallists.php.net Subject: [PHP] Re: massive MySQL tables

    I have similar problems with 2 huge forms. The best thing I am doing is to divide among lots of Mysql tables. And follow a lot of performance hints from its manual.

    For example, separate variable length fields from those who are not (ie Varchar in a table, Int on another).

    And so it goes... Maybe if you are really concerned, store some data that will never change in files.... Non-dynamic data doesn't follow the database concept, does it?... :-)

    --
    

    Julio Nobrega

    A hora esta chegando: http://toca.sourceforge.net "Justin French" <justinindent.com.au> wrote in message news:3BC22718.CF31EF78indent.com.au... > Hi all, > > Sorry for being slightly OT, but I'm working on a site with a large > application form (84 fields) which people have to fill in. The form is > rendering in the browser pretty quick (my first worry), but now I'm > concerned that 85+ data fields in MySQL might create performance > problems on the server. > > Is this likely? > > Most fields are "medium text" or "varchar", and will not need to be > searched at all, so i'll prolly just index the two or three important > ones, and leave it at that. > > > If there is likley to be a performance hit, what other options will I have? > > > Justin French

    -- 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:


    "Maybe if you are really concerned, store some data that will never change in files.... Non-dynamic data doesn't follow the database concept, does it?... :-)"

    Sure it does. Most enterprise databases also include static tables, in addition to dynamic tables. These are often known as Reference or Domain tables. Databases are great at indexing for fast searching of table rows. Stay away from large flat files.

    Speaking of which, I recommend that you (Jason) isolate any data that may be entered often, like when a user selects from possible values such as state names, and make these seperate domain tables. Then all you need to insert into your dynamic table is an integer ID associated with the actual value. Saves space and makes your db design more scalable and flexible.

    Johan

    -----Original Message----- From: Julio Nobrega Trabalhando [mailto:inerteARROBAhotmail.compb1.pair.com] Sent: Tuesday, October 09, 2001 6:37 AM To: php-generallists.php.net Subject: [PHP] Re: massive MySQL tables

    I have similar problems with 2 huge forms. The best thing I am doing is to divide among lots of Mysql tables. And follow a lot of performance hints from its manual.

    For example, separate variable length fields from those who are not (ie Varchar in a table, Int on another).

    And so it goes... Maybe if you are really concerned, store some data that will never change in files.... Non-dynamic data doesn't follow the database concept, does it?... :-)

    --
    

    Julio Nobrega

    A hora esta chegando: http://toca.sourceforge.net "Justin French" <justinindent.com.au> wrote in message news:3BC22718.CF31EF78indent.com.au... > Hi all, > > Sorry for being slightly OT, but I'm working on a site with a large > application form (84 fields) which people have to fill in. The form is > rendering in the browser pretty quick (my first worry), but now I'm > concerned that 85+ data fields in MySQL might create performance > problems on the server. > > Is this likely? > > Most fields are "medium text" or "varchar", and will not need to be > searched at all, so i'll prolly just index the two or three important > ones, and leave it at that. > > > If there is likley to be a performance hit, what other options will I have? > > > Justin French

    -- 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:


    i am now writing an extension, and need to invoke oracle functions, how can i? thanks in advanc, ^_^

    attached mail follows:


    This is because in php.ini (/etc/php.ini on *nix) the error_reporting is set to E_ALL. You can change it to 0 for example but it's better when you develop to set error_reporting(0); in your php scripts. this will override the setting from the php.ini

    after changing some things in php, restart the deamon/service of apache( if the php is built as module ,not CGI)

    -- 
    Andrey Hristov
    Web Developer
    IcyGEN Corporation
    BALANCED SOLUTIONS
    http://www.icygen.com
    

    On Tuesday 09 October 2001 14:54, you wrote: > Me again > > I changed from PHP Version 3 to Version 4.0.5 (Apache). > > Setting a value to an array $a[][] > > $a[ 2 ][ 5 ] = 4711; > > produces an warning > > Undefined offset 5 > > I got no declaration of $a because this was not needed with PHP 3. > Application runs fine (except warning output). Who can help? > > Thanks a lot > Andy.

    attached mail follows:


    $my_ar = array(); and also you may use array_pad to fill the array with one command and the change the values in it.

    -- 
    Andrey Hristov
    Web Developer
    IcyGEN Corporation
    BALANCED SOLUTIONS
    http://www.icygen.com
    

    On Tuesday 09 October 2001 15:49, you wrote: > Thanks for help > > But is there a way to properly declare > the array, so php doesn't have to warn? > > Andy. > ----- Original Message ----- > From: Andrey Hristov > Newsgroups: php.general > To: php-generallists.php.net > Sent: Tuesday, October 09, 2001 2:45 PM > Subject: Re: [PHP] Undefined offset > > > This is because in php.ini (/etc/php.ini on *nix) the error_reporting is > set to E_ALL. You can change it to 0 for example but it's better when you > develop to set > error_reporting(0); > in your php scripts. this will override the setting from the php.ini > > after changing some things in php, restart the deamon/service of apache( > if the php is built as module ,not CGI) > > -- > Andrey Hristov > Web Developer > IcyGEN Corporation > BALANCED SOLUTIONS > http://www.icygen.com > > On Tuesday 09 October 2001 14:54, you wrote: > > Me again > > > > I changed from PHP Version 3 to Version 4.0.5 (Apache). > > > > Setting a value to an array $a[][] > > > > $a[ 2 ][ 5 ] = 4711; > > > > produces an warning > > > > Undefined offset 5 > > > > I got no declaration of $a because this was not needed with PHP 3. > > Application runs fine (except warning output). Who can help? > > > > Thanks a lot > > Andy.

    attached mail follows:


    "Rw" <roydallas61nospamhotmail.com> wrote in message news:20011009111747.94889.qmailpb1.pair.com... > I have a form which variables ($q1 and $q2) to a PHP script and the sql > statment is also passed as a hidden vriable called $sqlstatement > > When I set $sqlstatement = INSERT INTO tdefa8 VALUES ("$q1", "$q2", > "2001-10-09") > THEN it inserts "$q1" and "$q2" into the database - rather than their > assigned values > > When I set $sqlstatement = INSERT INTO tdefa8 VALUES ($q1, $q2, > "2001-10-09") > THEN it doesn't insert ANYTHING > > FYI: I execute the statemnet like this: > $query = "$sqlstatement"; > $result = MYSQL_QUERY($query); > > I even tried: $query = $sqlstatement; > > > Any ideas?

    Hey,

    Shouldn't the variables be wrapped with single quotes?

    $sqlstatement = "INSERT INTO tdefa8 VALUES ('$q1', '$q2', '2001-10-09')"; $result = mysql_query($sqlstatement) // check for sql errors or die (mysql_error());

    James

    attached mail follows:


    Pardon me if your code was just shorthand but:

    When I set $sqlstatement = INSERT INTO tdefa8 VALUES ("$q1", "$q2", "2001-10-09") THEN it inserts "$q1" and "$q2" into the database - rather than their assigned values

    When I set $sqlstatement = INSERT INTO tdefa8 VALUES ($q1, $q2, "2001-10-09") THEN it doesn't insert ANYTHING

    FYI: I execute the statement like this: $query = "$sqlstatement"; $result = MYSQL_QUERY($query);

    I even tried: $query = $sqlstatement;

    try:

    $sqlstatement = "INSERT INTO tdefa8 VALUES ('$q1', '$q2', '2001-10-09')";

    or

    $sqlstatement = "INSERT INTO tdefa8 VALUES (\"$q1\",\"$q2\", \"2001-10-09\")";

    both work for me.

    Thanks,

    Wade Berlin, Backstreet Production Group Inc.

    ---------------------------------------------- Backstreet Production Group......www.bpweb.com 904.398.8730................(fax) 904.396.0335 ----------------------------------------------

    attached mail follows:


    The inserts works in this way because they are

    mysql_query('INSERT .... ("$q1..... '); the surounding ' says to php to not look at the string for variable substitution. Try mysql_query("INSERT .... ('$q1'.... "); that will work as you wish

    -- 
    Andrey Hristov
    Web Developer
    IcyGEN Corporation
    BALANCED SOLUTIONS
    http://www.icygen.com
    

    On Tuesday 09 October 2001 17:24, you wrote: > Pardon me if your code was just shorthand but: > > When I set $sqlstatement = INSERT INTO tdefa8 VALUES ("$q1", "$q2", > "2001-10-09") > THEN it inserts "$q1" and "$q2" into the database - rather than their > assigned values > > When I set $sqlstatement = INSERT INTO tdefa8 VALUES ($q1, $q2, > "2001-10-09") > THEN it doesn't insert ANYTHING > > FYI: I execute the statement like this: > $query = "$sqlstatement"; > $result = MYSQL_QUERY($query); > > I even tried: $query = $sqlstatement; > > try: > > $sqlstatement = "INSERT INTO tdefa8 VALUES ('$q1', '$q2', > '2001-10-09')"; > > or > > $sqlstatement = "INSERT INTO tdefa8 VALUES (\"$q1\",\"$q2\", > \"2001-10-09\")"; > > both work for me. > > Thanks, > > Wade Berlin, Backstreet Production Group Inc. > > ---------------------------------------------- > Backstreet Production Group......www.bpweb.com > 904.398.8730................(fax) 904.396.0335 > ----------------------------------------------

    attached mail follows:


    echo($q1); echo($q2); $query = "INSERT INTO table VALUES('$q1','$q2','2001-10-09')" echo $query;

    Try this.

    At 06:17 AM 10/9/2001 -0500, Rw wrote: >I have a form which variables ($q1 and $q2) to a PHP script and the sql >statment is also passed as a hidden vriable called $sqlstatement > >When I set $sqlstatement = INSERT INTO tdefa8 VALUES ("$q1", "$q2", >"2001-10-09") >THEN it inserts "$q1" and "$q2" into the database - rather than their >assigned values > >When I set $sqlstatement = INSERT INTO tdefa8 VALUES ($q1, $q2, >"2001-10-09") >THEN it doesn't insert ANYTHING > >FYI: I execute the statemnet like this: >$query = "$sqlstatement"; >$result = MYSQL_QUERY($query); > >I even tried: $query = $sqlstatement; > > >Any ideas? > > > > >-- >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:


    Send your script to me (or the list) and I'll come with a much better way!

    -Jason Garber IonZoft.com

    At 06:17 AM 10/9/2001 -0500, Rw wrote: >I have a form which variables ($q1 and $q2) to a PHP script and the sql >statment is also passed as a hidden vriable called $sqlstatement > >When I set $sqlstatement = INSERT INTO tdefa8 VALUES ("$q1", "$q2", >"2001-10-09") >THEN it inserts "$q1" and "$q2" into the database - rather than their >assigned values > >When I set $sqlstatement = INSERT INTO tdefa8 VALUES ($q1, $q2, >"2001-10-09") >THEN it doesn't insert ANYTHING > >FYI: I execute the statemnet like this: >$query = "$sqlstatement"; >$result = MYSQL_QUERY($query); > >I even tried: $query = $sqlstatement; > > >Any ideas? > > > > >-- >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:


    Removing the quotes should insert the values of these variable (or nothing if the values are empty) =)

    >

    --
     - Tim
    PHP Galaxy: http://www.phpgalaxy.com/
    The LavaWarp Engine: http://www.phpgalaxy.com/engine.php3
    BitSearch: http://www.phpgalaxy.com/bitsearch.php3
    MetaWarp: http://www.phpgalaxy.com/metawarp.php3
    PhotoRate: http://www.phpgalaxy.com/photorate.php3
    Earn $10 per order selling these scripts on your site!
    http://www.phpgalaxy.com/aff/
    

    attached mail follows:


    Why does this produce a warning:

    echo "<?xml version=\'1.0\'?>";

    but not this:

    echo "<\?xml version=\'1.0\'\?>";

    ?

    <? ?> inside a string shouldnt be executed, or should it?

    /Martin

    attached mail follows:


    you can do this: echo "<?hello world!?>\n"; no problem!

    btw, why are you escaping the single quote?!

    "Martin Lindhe" <martinhumany.com> wrote in message news:831D8A28AF18D5119EAA00E018C5B81C23BABBMAIL1... > Why does this produce a warning: > > echo "<?xml version=\'1.0\'?>"; > > > but not this: > > echo "<\?xml version=\'1.0\'\?>"; > > ? > > <? ?> inside a string shouldnt be executed, or should it? > > /Martin

    attached mail follows:


    > you can do this: > echo "<?hello world!?>\n"; > no problem! > > btw, why are you escaping the single quote?! >

    Nevermind, the parse error produced was because of other faulty code, not the echo line. Sorry for bothering the mailinglist.

    /Martin

    attached mail follows:


    Hi all,

    I have a query which returns X amount of rows. I would like to display even rows one colour and odd rows a different colour. Is there a way to do this?

    Thanks in advance,

    Sam Rose

    p.s. Also I'm only on the digest, so if you could reply directly to me as well, that would be a bonus.

    attached mail follows:


    if ($number_of_rows%2 == 0) { // number of rows is even } else { // it's odd }

    regards

    Dave

    -----Original Message----- From: Sam [mailto:Samdragoman.co.uk] Sent: 09 October 2001 14:31 To: 'php' Subject: [PHP] Anyway of knowing whether a integer is odd or even

    Hi all,

    I have a query which returns X amount of rows. I would like to display even rows one colour and odd rows a different colour. Is there a way to do this?

    Thanks in advance,

    Sam Rose

    p.s. Also I'm only on the digest, so if you could reply directly to me as well, that would be a bonus.

    attached mail follows:


    presumes your loop index you're using to step through your recordset is called '$i'

    <tr bgcolor="#<?=$i%2 == 0 ? "ff0000" : "0000ff"?>">

    ----- Original Message ----- From: "Sam" <Samdragoman.co.uk> To: "'php'" <php-generallists.php.net> Sent: Tuesday, October 09, 2001 11:30 PM Subject: [PHP] Anyway of knowing whether a integer is odd or even

    > Hi all, > > I have a query which returns X amount of rows. > I would like to display even rows one colour and odd rows a different > colour. > Is there a way to do this? > > Thanks in advance, > > Sam Rose > > p.s. Also I'm only on the digest, so if you could reply directly to me as > well, that would be a bonus. >

    attached mail follows:


    > I have a query which returns X amount of rows. > I would like to display even rows one colour and odd rows a different > colour. > Is there a way to do this? do

    <? $color = "red"; for ($i = 0; $i < count($result_table); $i++ ) { echo "<TR BGCOLOR=$color><TD>" . $result_table[$i]["column"] . "</TD></TR>"; if ($color=="red") { $color = "blue"; } else { $color = "red"; } } ?>

    attached mail follows:


    inside your loops just do something like this echo "<table>\n"; $colorarry = array("red", "green", "blue", "pink"); foreach($blah as $field) { if(empty($tempnum)) $tempnum = 0; $color = $colorarray[$tempnum]; if($tempnum != sizeof($colorarray)) $tempnum++; else $tempnum = 0; echo "<tr><td bgcolor=$color>$field</td></tr>\n"; } ----- Original Message ----- From: "Sam" <Samdragoman.co.uk> To: "'php'" <php-generallists.php.net> Sent: Tuesday, October 09, 2001 11:30 PM Subject: [PHP] Anyway of knowing whether a integer is odd or even

    > Hi all, > > I have a query which returns X amount of rows. > I would like to display even rows one colour and odd rows a different > colour. > Is there a way to do this? > > Thanks in advance, > > Sam Rose > > p.s. Also I'm only on the digest, so if you could reply directly to me as > well, that would be a bonus. >

    attached mail follows:


    sometimes you don't want to know whether odd or even to do what you're asking for, therefore, consider the XOR example:

    $colors = array("red", "green"); $start = 0; while ($row = mysql_fetch_array($result)) { echo "<td bgcolor='{$colors[$start]}'>{$row[firstnamename]}</td>"; $start ^= 1; // 1 xor 1 = 0, 0 xor 1 = 1, etc.... } etc..... "Sam" <Samdragoman.co.uk> wrote in message news:478EB6C82CC2D4119AF300B0D07963F4115C85NTSERVER01... > Hi all, > > I have a query which returns X amount of rows. > I would like to display even rows one colour and odd rows a different > colour. > Is there a way to do this? > > Thanks in advance, > > Sam Rose > > p.s. Also I'm only on the digest, so if you could reply directly to me as > well, that would be a bonus. >

    attached mail follows:


    $color = "white";

    while .. { display row using $color

    $color = ($color=="white" ? "grey" : "white"); }

    -Stewart

    -----Original Message----- From: Sam [mailto:Samdragoman.co.uk] Sent: 09 October 2001 14:31 To: 'php' Subject: [PHP] Anyway of knowing whether a integer is odd or even

    Hi all,

    I have a query which returns X amount of rows. I would like to display even rows one colour and odd rows a different colour. Is there a way to do this?

    Thanks in advance,

    Sam Rose

    p.s. Also I'm only on the digest, so if you could reply directly to me as well, that would be a bonus.

    attached mail follows:


    just in case others have this issue, the numeric solution is this: $num = 10; if($num % 2 == 0){ echo "number is even"; } else { echo "number is odd"; }

    -----Original Message----- From: Taylor, Stewart [mailto:Stewart.Tayloruk.thalesgroup.com] Sent: Tuesday, October 09, 2001 10:10 AM To: 'Sam' Cc: php-generallists.php.net Subject: RE: [PHP] Anyway of knowing whether a integer is odd or even

    $color = "white";

    while .. { display row using $color

    $color = ($color=="white" ? "grey" : "white"); }

    -Stewart

    -----Original Message----- From: Sam [mailto:Samdragoman.co.uk] Sent: 09 October 2001 14:31 To: 'php' Subject: [PHP] Anyway of knowing whether a integer is odd or even

    Hi all,

    I have a query which returns X amount of rows. I would like to display even rows one colour and odd rows a different colour. Is there a way to do this?

    Thanks in advance,

    Sam Rose

    p.s. Also I'm only on the digest, so if you could reply directly to me as well, that would be a bonus.

    -- 
    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:


    Sorry ignore my previous message I misread the question.

    If an integer is old then ($theInt % 2) > 0. If event then ($theInt % 2) == 0

    Here % = modulus operator which returns remainder of a division.

    -Stewart

    -----Original Message----- From: Taylor, Stewart [mailto:Stewart.Tayloruk.thalesgroup.com] Sent: 09 October 2001 15:10 To: 'Sam' Cc: php-generallists.php.net Subject: RE: [PHP] Anyway of knowing whether a integer is odd or even

    $color = "white";

    while .. { display row using $color

    $color = ($color=="white" ? "grey" : "white"); }

    -Stewart

    -----Original Message----- From: Sam [mailto:Samdragoman.co.uk] Sent: 09 October 2001 14:31 To: 'php' Subject: [PHP] Anyway of knowing whether a integer is odd or even

    Hi all,

    I have a query which returns X amount of rows. I would like to display even rows one colour and odd rows a different colour. Is there a way to do this?

    Thanks in advance,

    Sam Rose

    p.s. Also I'm only on the digest, so if you could reply directly to me as well, that would be a bonus.

    -- 
    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:


    It is generally faster to use bitwise operators...

    if ($theInt & 1) print "$theInt is odd"; else print "$theInt is even";

    This is usually the case for most languages, like C or C++ or what have you. It's probably the same in PHP, since the & operator doesn't need to worry about returning the remainder, just the bits that are set in both $theInt and 1.

    J

    Stewart Taylor wrote:

    > Sorry ignore my previous message I misread the question. > > If an integer is old then ($theInt % 2) > 0. > If event then ($theInt % 2) == 0 > > Here % = modulus operator which returns remainder of a division. > > -Stewart > > -----Original Message----- > From: Taylor, Stewart [mailto:Stewart.Tayloruk.thalesgroup.com] > Sent: 09 October 2001 15:10 > To: 'Sam' > Cc: php-generallists.php.net > Subject: RE: [PHP] Anyway of knowing whether a integer is odd or even > > > $color = "white"; > > while .. > { > display row using $color > > > $color = ($color=="white" ? "grey" : "white"); > } > > -Stewart > > -----Original Message----- > From: Sam [mailto:Samdragoman.co.uk] > Sent: 09 October 2001 14:31 > To: 'php' > Subject: [PHP] Anyway of knowing whether a integer is odd or even > > > Hi all, > > I have a query which returns X amount of rows. > I would like to display even rows one colour and odd rows a different > colour. > Is there a way to do this? > > Thanks in advance, > > Sam Rose > > p.s. Also I'm only on the digest, so if you could reply directly to me as > well, that would be a bonus. >

    attached mail follows:


    On Tue, 09 Oct 2001 13:07:17 -0400, you wrote:

    >It is generally faster

    (but harder to read)

    >to use bitwise operators... > >if ($theInt & 1) > print "$theInt is odd"; >else > print "$theInt is even"; > >This is usually the case for most languages, like C or C++ or what have >you. It's probably the same in PHP, since the & operator doesn't need to >worry about returning the remainder, just the bits that are set in both >$theInt and 1.

    I'm sure I don't want to get into this, but...

    If speed is that important, why would you use a scripting language?

    djo

    attached mail follows:


    Is

    if ($theInt & 1)

    really that much harder to read than

    if ($theInt % 2 > 0)

    ?

    And why wouldn't you want to get the most performance out of your code, regardless of the language, scripting or otherwise? Especially when it's a one or two character switch that makes the difference?

    I doubt that PHP should be classified as a scripting language any more than Perl is. Scripting languages are usually used to glue different applications together, like a shell script that uses awk and sed or whatever. PHP can be used to build applications, so it's more than a scripting language. Interpreted language is more like it.

    J

    David Otton wrote:

    > On Tue, 09 Oct 2001 13:07:17 -0400, you wrote: > >>It is generally faster > > (but harder to read) > >>to use bitwise operators... >> >>if ($theInt & 1) >> print "$theInt is odd"; >>else >> print "$theInt is even"; >> >>This is usually the case for most languages, like C or C++ or what have >>you. It's probably the same in PHP, since the & operator doesn't need to >>worry about returning the remainder, just the bits that are set in both >>$theInt and 1. > > I'm sure I don't want to get into this, but... > > If speed is that important, why would you use a scripting language? > > djo

    attached mail follows:


    Why read more than one line? Here's what I do to change the background of odd/even rows of SQL resultset data displayed in an HTML table:

    (ceil($i % 2)>0) ? ($BGcolor=$oddRow) : ($BGcolor=$evenRow);

    Steve Orr

    -----Original Message----- From: J Smith [mailto:dark_pandahushmail.com] Sent: Tuesday, October 09, 2001 2:18 PM To: php-generallists.php.net Subject: Re: [PHP] Anyway of knowing whether a integer is odd or even

    Is

    if ($theInt & 1)

    really that much harder to read than

    if ($theInt % 2 > 0)

    ?

    And why wouldn't you want to get the most performance out of your code, regardless of the language, scripting or otherwise? Especially when it's a one or two character switch that makes the difference?

    I doubt that PHP should be classified as a scripting language any more than Perl is. Scripting languages are usually used to glue different applications together, like a shell script that uses awk and sed or whatever. PHP can be used to build applications, so it's more than a scripting language. Interpreted language is more like it.

    J

    David Otton wrote:

    > On Tue, 09 Oct 2001 13:07:17 -0400, you wrote: > >>It is generally faster > > (but harder to read) > >>to use bitwise operators... >> >>if ($theInt & 1) >> print "$theInt is odd"; >>else >> print "$theInt is even"; >> >>This is usually the case for most languages, like C or C++ or what have >>you. It's probably the same in PHP, since the & operator doesn't need to >>worry about returning the remainder, just the bits that are set in both >>$theInt and 1. > > I'm sure I don't want to get into this, but... > > If speed is that important, why would you use a scripting language? > > djo

    -- 
    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:


    ---------- From: Dave Watkinson [SMTP:d.watkinsonmightymatch.com] Sent: 09 October 2001 11:59 To: Kamil Nowicki; php-generallists.php.net Subject: RE: [PHP] nested includes()...

    I had something like that ... one include file for all my database functions and another included in there for the database connection info.

    Eventually I found I had to use absolute paths (on Win2K) starting at d:/<etc> I do this in windows, but use system variables (e.g. $DOCUMENT_ROOT) for future proofing. I'm hoping this will help if I ever get a proper (i.e. Linux) server. I'm writing to Santa ...

    Tim Ward

    HTH!!

    Dave

    -----Original Message----- From: Kamil Nowicki [mailto:hilarionelfin.pl] Sent: 09 October 2001 11:55 To: php-generallists.php.net Subject: Re: [PHP] nested includes()...

    > I have a file x.php that includes a.inc, and a.inc includes b.inc... > > if I have a file dir/z.php including ../a.inc it doesn't work cuz it won't > find b.inc... > > how can I get around this??? in file dir/z.php do:

    <? chdir( ".." ); include( "a.inc" ); chdir( "dir" ); ?>

    This way all included files have proper current working directory and are able to include anything else (not depending on above 'dir' directory structure, so it's movable structure). The only problem is that 'z.php' has to be aware that it's in 'dir' directory.

    Kamil 'Hilarion' Nowicki

    -- 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:


    that way if the include dir changes I have to go trough each file to change it??

    that doesn't solve my problem at all...

    At 23:00 08/10/01 -0400, Jason G. wrote: >Alas, I have your solution! > >I have gotten around this very problem by saying at the top of a script: > >define(_INCLUDE_DIR, '/home/pad/include/'); //note trailing slash > >Anytime i include a file: >include(_INCLUDE_DIR . "lib.data.php"); > >It works always. > >-Jason Garber >IonZoft.com > > > >At 10:20 PM 10/8/2001 -0300, Christian Dechery wrote: >>I have a file x.php that includes a.inc, and a.inc includes b.inc... >> >>if I have a file dir/z.php including ../a.inc it doesn't work cuz it >>won't find b.inc... >> >>how can I get around this??? >> >> >>_____________________________ >>. Christian Dechery >>. . Gaita-L Owner / Web Developer >>. . http://www.webstyle.com.br >>. . http://www.tanamesa.com.br >> >> >>-- >>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:


    ><? >chdir( ".." ); >include( "a.inc" ); >chdir( "dir" ); >?> > >This way all included files have proper current working >directory and are able to include anything else (not depending >on above 'dir' directory structure, so it's movable structure). >The only problem is that 'z.php' has to be aware that it's in 'dir' >directory.

    yeah... and it's not generic... I can't go creating dirs and hope this works every time... I want a solution like this...

    attached mail follows:


    At 14:06 09/10/01 +0300, Andrey Hristov wrote: >Good style is to have a central scripts with defines such >define("SITE_HTML","/var/www/virtual/www.mysite.com/private/html") >and so on for every such dir >using ><?php > include SITE_HTML."login.html"; >?> > >In every directory on your visible part of the web server paste a file with >name like this : link_to_defs.php which includes the central script so you >can place the central script anywhere in your server. >Every script must include/require "link_to_defs.php" and everything will be >good, after that you can use your defines. If you want to move your script >to another location, there is no problem if in the new place there are >link_to_defs.php

    yeah... that for me is the best solution.... to have every file calling a single file that can't change its location... and define everything in there... something like a GLOBAL.ASA... that I think is a great idea....

    attached mail follows:


    I use this solution:

    Directory structure: .../xxx/wwwroot/dir1/index.php .../xxx/wwwroot/dir2/index.php .../xxx/outside-www-area/engine/engine.php // includes libs used in all scripts .../xxx/outside-www-area/document/dir1/ // docs only for /dir1/ .../xxx/outside-www-area/document/dir2/ // docs only for /dir2/

    index.php just sets two variables, $ENGINE and $DOCUMENT, (use the path to the script itself) and then calls include ($ENGINE . 'engine.php'). This script then uses include ($DOCUMENT . 'xyz.inc'); and the like to print out headers and footers and all other stuff.

    This way I can have identical scripts on a win98 (dev) and a Linux (prod) environment. The paths are completely different, but that doesn't matter.

    You could use this also with includes inside the www area, but thats not so good for security reasons.

    Anders Nawroth

    webmaster www.bibbi.nawroth.com

    ----- Ursprungligt meddelande ----- Från: "Christian Dechery" <cdecheryeasynet.com.br> Till: "Jason G." <blairnb.net> Kopia: <php-generallists.php.net> Skickat: den 9 oktober 2001 19:33 Ämne: Re: [PHP] nested includes()...

    that way if the include dir changes I have to go trough each file to change it??

    that doesn't solve my problem at all...

    At 23:00 08/10/01 -0400, Jason G. wrote: >Alas, I have your solution! > >I have gotten around this very problem by saying at the top of a script: > >define(_INCLUDE_DIR, '/home/pad/include/'); //note trailing slash > >Anytime i include a file: >include(_INCLUDE_DIR . "lib.data.php"); > >It works always. > >-Jason Garber >IonZoft.com > > > >At 10:20 PM 10/8/2001 -0300, Christian Dechery wrote: >>I have a file x.php that includes a.inc, and a.inc includes b.inc... >> >>if I have a file dir/z.php including ../a.inc it doesn't work cuz it >>won't find b.inc... >> >>how can I get around this??? >> >> >>_____________________________ >>. Christian Dechery >>. . Gaita-L Owner / Web Developer >>. . http://www.webstyle.com.br >>. . http://www.tanamesa.com.br >> >> >>-- >>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:


    At 21:23 09/10/01 +0200, anders nawroth wrote: >I use this solution: > >Directory structure: >.../xxx/wwwroot/dir1/index.php >.../xxx/wwwroot/dir2/index.php >.../xxx/outside-www-area/engine/engine.php // includes libs used in all >scripts >.../xxx/outside-www-area/document/dir1/ // docs only for /dir1/ >.../xxx/outside-www-area/document/dir2/ // docs only for /dir2/ > >index.php just sets two variables, >$ENGINE and $DOCUMENT, >(use the path to the script itself) and then >calls include ($ENGINE . 'engine.php'). >This script then uses >include ($DOCUMENT . 'xyz.inc'); and the like >to print out headers and footers and all other stuff.

    what if someone got trough your page directly trough /xxx/dir1/dir2/dir3/somepage.php, and this page had to include engine.php ??

    >This way I can have identical scripts on a >win98 (dev) and a Linux (prod) environment. >The paths are completely different, but >that doesn't matter. > >You could use this also with includes >inside the www area, but thats not so good >for security reasons. > > >Anders Nawroth > >webmaster >www.bibbi.nawroth.com > > >----- Ursprungligt meddelande ----- >Från: "Christian Dechery" <cdecheryeasynet.com.br> >Till: "Jason G." <blairnb.net> >Kopia: <php-generallists.php.net> >Skickat: den 9 oktober 2001 19:33 >Ämne: Re: [PHP] nested includes()... > > >that way if the include dir changes I have to go trough each file to change >it?? > >that doesn't solve my problem at all... > >At 23:00 08/10/01 -0400, Jason G. wrote: > >Alas, I have your solution! > > > >I have gotten around this very problem by saying at the top of a script: > > > >define(_INCLUDE_DIR, '/home/pad/include/'); //note trailing slash > > > >Anytime i include a file: > >include(_INCLUDE_DIR . "lib.data.php"); > > > >It works always. > > > >-Jason Garber > >IonZoft.com > > > > > > > >At 10:20 PM 10/8/2001 -0300, Christian Dechery wrote: > >>I have a file x.php that includes a.inc, and a.inc includes b.inc... > >> > >>if I have a file dir/z.php including ../a.inc it doesn't work cuz it > >>won't find b.inc... > >> > >>how can I get around this??? > >> > >> > >>_____________________________ > >>. Christian Dechery > >>. . Gaita-L Owner / Web Developer > >>. . http://www.webstyle.com.br > >>. . http://www.tanamesa.com.br > >> > >> > >>-- > >>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 is how I have taken care of my include problems. --------------------------------------------------------------- I create a file in each directory called _stdinc.php which contains: <? define('_INCLUDE_DIR', '../../include/'); include(_INCLUDE_DIR . 'stdinc.php'); ?>

    In the include dir, I have a script called stdinc.php which contains: <? include(_INCLUDE_DIR . 'lib.data.php'); include(_INCLUDE_DIR . 'lib.sessions.php'); include(_INCLUDE_DIR . 'lib.forms.php'); include(_INCLUDE_DIR . 'lib.email.php'); ?>

    At the top of every script, I simply write: <? require('_sdtinc.php'); . . .

    This way, if I change move directory's, I only have to edit _stdinc.php in each dir that changes. ------------------------------------------------------------------------------------- I have a more efficient way worked out that lets you optionally include whichever headers you want in a particular script by saying: <? define('_INCLUDE_LIST','CORE, LIB_DATA, LIB_EMAIL'); //Optional require('_stdinc.php'); . . .

    Let me know if you, or anyone wants to make use of that method.

    -Jason Garber IonZoft.com

    At 02:33 PM 10/9/2001 -0300, Christian Dechery wrote: that way if the include dir changes I have to go trough each file to change it??

    that doesn't solve my problem at all...

    At 23:00 08/10/01 -0400, Jason G. wrote: Alas, I have your solution!

    I have gotten around this very problem by saying at the top of a script:

    define(_INCLUDE_DIR, '/home/pad/include/'); //note trailing slash

    Anytime i include a file: include(_INCLUDE_DIR . "lib.data.php");

    It works always.

    -Jason Garber IonZoft.com

    At 10:20 PM 10/8/2001 -0300, Christian Dechery wrote: I have a file x.php that includes a.inc, and a.inc includes b.inc...

    if I have a file dir/z.php including ../a.inc it doesn't work cuz it won't find b.inc...

    how can I get around this???

    _____________________________ . Christian Dechery . . Gaita-L Owner / Web Developer . . http://www.webstyle.com.br . . http://www.tanamesa.com.br

    --
    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

    I have a few msaccess dbs (.mdb files) that I need to open, extract and join data then update a MySQL database. I want to open MsAccess files (.mdb) using PHP, loop through results and create a .csv filethe just lod content into a MySQL table.

    Say my file is called first.mdb I am running RH6.2 and PHP4

    How do I open a .mdb file? Do I need to use ODBC? Any tutorials or example scripts.

    Regards

    Ajdin

    attached mail follows:


    I think that the only way to access Access from PHP you have to use ODBC. The loop is easy select * from the_table;

    after than $num_rows=mysql_num_rows($result); $showed = 0; for ($counter=0;$counter<=$num_rows;$counter++){ $ar=mysql_fetch_assoc($result); foreach ($ar as $key=>$value){ echo $value; } }

    -- 
    Andrey Hristov
    Web Developer
    IcyGEN Corporation
    BALANCED SOLUTIONS
    http://www.icygen.com 
    

    On Tuesday 09 October 2001 16:49, you wrote: > Hi > > I have a few msaccess dbs (.mdb files) that I need to open, extract and > join data then update a MySQL database. I want to open MsAccess files > (.mdb) using PHP, loop through results and create a .csv filethe just lod > content into a MySQL table. > > Say my file is called first.mdb > I am running RH6.2 and PHP4 > > How do I open a .mdb file? Do I need to use ODBC? > Any tutorials or example scripts. > > Regards > > Ajdin

    attached mail follows:


    Is the answer to this iodbc? Does it mean that I have to recompile php and apache?

    Ajdin

    On Tue, 9 Oct 2001, Andrey Hristov wrote:

    > I think that the only way to access Access from PHP you have to use ODBC. > The loop is easy > select * from the_table; > > after than > $num_rows=mysql_num_rows($result); > $showed = 0; > for ($counter=0;$counter<=$num_rows;$counter++){ > $ar=mysql_fetch_assoc($result); > foreach ($ar as $key=>$value){ > echo $value; > } > } > > -- > Andrey Hristov > Web Developer > IcyGEN Corporation > BALANCED SOLUTIONS > http://www.icygen.com > > > On Tuesday 09 October 2001 16:49, you wrote: > > Hi > > > > I have a few msaccess dbs (.mdb files) that I need to open, extract and > > join data then update a MySQL database. I want to open MsAccess files > > (.mdb) using PHP, loop through results and create a .csv filethe just lod > > content into a MySQL table. > > > > Say my file is called first.mdb > > I am running RH6.2 and PHP4 > > > > How do I open a .mdb file? Do I need to use ODBC? > > Any tutorials or example scripts. > > > > Regards > > > > Ajdin > > > -- > 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:


    I've never did this but I heard from a friend that he succeeded to connect from PHP to Access with ODBC. If you use PHP under windows there is no need of recompile just edit your php.ini to enable the extension by default for odbc. Otherwise you have to use dl() function to load the odbs module in the head of your script. RTFM. It is good.

    -- 
    Andrey Hristov
    Web Developer
    IcyGEN Corporation
    BALANCED SOLUTIONS
    http://www.icygen.com
    

    On Tuesday 09 October 2001 17:21, you wrote: > Is the answer to this iodbc? Does it mean that I have to recompile php > and apache? > > Ajdin > > On Tue, 9 Oct 2001, Andrey Hristov wrote: > > I think that the only way to access Access from PHP you have to use ODBC. > > The loop is easy > > select * from the_table; > > > > after than > > $num_rows=mysql_num_rows($result); > > $showed = 0; > > for ($counter=0;$counter<=$num_rows;$counter++){ > > $ar=mysql_fetch_assoc($result); > > foreach ($ar as $key=>$value){ > > echo $value; > > } > > } > > > > -- > > Andrey Hristov > > Web Developer > > IcyGEN Corporation > > BALANCED SOLUTIONS > > http://www.icygen.com > > > > On Tuesday 09 October 2001 16:49, you wrote: > > > Hi > > > > > > I have a few msaccess dbs (.mdb files) that I need to open, extract and > > > join data then update a MySQL database. I want to open MsAccess files > > > (.mdb) using PHP, loop through results and create a .csv filethe just > > > lod content into a MySQL table. > > > > > > Say my file is called first.mdb > > > I am running RH6.2 and PHP4 > > > > > > How do I open a .mdb file? Do I need to use ODBC? > > > Any tutorials or example scripts. > > > > > > Regards > > > > > > Ajdin > > > > -- > > 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:


    Ajdin,

    ODBC will allow you to connect to a database server, e.g. Access, MySQL, Oracle, etc... but not open the .mdb file without that server running. So... you can use ODBC from Linux if the .mbd is on Windows, but for what you want you may just want to convert the .mdb to MySQL form.

    There should be an application on the MySQL links page to assist here.

    Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access & Data Integration Technology Providers

    > -----Original Message----- > From: AJDIN BRANDIC [mailto:abrandiccoventry.ac.uk] > Sent: Tuesday, October 09, 2001 9:49 AM > To: php-generallists.php.net > Subject: [PHP] access database on linux > > > Hi > > I have a few msaccess dbs (.mdb files) that I need to open, > extract and join > data then update a MySQL database. I want to open MsAccess files (.mdb) > using PHP, loop through results and create a .csv filethe just lod > content into a MySQL table. > > Say my file is called first.mdb > I am running RH6.2 and PHP4 > > How do I open a .mdb file? Do I need to use ODBC? > Any tutorials or example scripts. > > Regards > > Ajdin > > -- > 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:


    It should. The next thing I would ask is are you looking at the resulting file in a Windows based text tool like NotePad? If so, you won't see the newline. Use WordPad on Windows if this is the problem or write "\r\n" into the file.

    --
    Blake Schwendiman
    Intechra LLC
    PHP 4 Developer's Guide (http://www.amazon.com/exec/obidos/ASIN/0072127317/)
    

    "Big5ive" <big5ivegmx.net> wrote in message news:20011003171102.84009.qmailpb1.pair.com... > My Code: > $PW_LIST="../config/pw.txt"; > $fp=fopen("$PW_LIST","a"); > fputs($fp,"$username=$pw\n"); > fclose($fp); > > This should make a newline after printing $username=$pw, shouldn't it!? > But it doesn't!!! > >

    attached mail follows:


    Hi I need some help on creating a ref number! Lets say my first reference record in the database is 00001!

    Now i've got to create a function which everytime the user clicks on add 00001 must count to 00002 and 00003 and so on and when it gets to 00009 it must switch to 0000A then 0000B !!! Now the same with when it gets to 0000Z it must swith to 00010 then 00011 and when it gets to 00019 it must go to 0001A and so on ! Can anyone help me here i need to do this ! Thanks ALOT Coenraad Steenkamp

    attached mail follows:


    Using Postgresql write a trigger. Triggers are not supported by mysql.

    -- 
    Andrey Hristov
    Web Developer
    IcyGEN Corporation
    BALANCED SOLUTIONS
    http://www.icygen.com
    

    On Tuesday 09 October 2001 16:52, you wrote: > Hi > I need some help on creating a ref number! > Lets say my first reference record in the database is 00001! > > Now i've got to create a function which everytime the user clicks on add > 00001 must count to 00002 and 00003 and so on > and when it gets to 00009 it must switch to 0000A then 0000B !!! > Now the same with when it gets to 0000Z it must swith to 00010 then 00011 > and when it gets to 00019 it must go to 0001A and so on ! > Can anyone help me here i need to do this ! > Thanks ALOT > Coenraad Steenkamp

    attached mail follows:


    Ok, either I missed something really simple or ...

    Here's the code:

    $comp = trim($data->comp); $YY = substr($comp,0,3); $MM = substr($comp,5,6); $DD = substr($comp,8,9); echo "COMP is $comp<BR>"; echo "DATE is $YY" . "," . "$MM" . "," . $DD;

    The results are:

    COMP is 2002-10-29 DATE is 200,10-29,29

    Now, shouldn't it be:

    COMP is 2002-10-29 DATE is 2002,10,29

    This exact code snippet works fine one another page but not this one ...

    What is the obvious thing I am not seeing?

    Jc

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

    attached mail follows:


    look at what you've typed, and look at the manual for substr()

    the args for substr() are (string, start, length)

    in the $YY call you specified to extract 3 characters from $comp, not 4.

    and likewise for the subsequent calls - the third argument in the brackets after substr( is the number of characters to extract.

    It's in the manual :-)

    Cheers

    Dave

    -----Original Message----- From: Jean-Christian Imbeault [mailto:jean_christianhotmail.com] Sent: 09 October 2001 14:54 To: php-generallists.php.net Subject: [PHP] [BUG?] substr giving strange results

    Ok, either I missed something really simple or ...

    Here's the code:

    $comp = trim($data->comp); $YY = substr($comp,0,3); $MM = substr($comp,5,6); $DD = substr($comp,8,9); echo "COMP is $comp<BR>"; echo "DATE is $YY" . "," . "$MM" . "," . $DD;

    The results are:

    COMP is 2002-10-29 DATE is 200,10-29,29

    Now, shouldn't it be:

    COMP is 2002-10-29 DATE is 2002,10,29

    This exact code snippet works fine one another page but not this one ...

    What is the obvious thing I am not seeing?

    Jc

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

    -- 
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: 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:


    string substr (string string, int start [, int length])

    3rd param is length

    jack

    -----Original Message----- From: Jean-Christian Imbeault [mailto:jean_christianhotmail.com] Sent: Tuesday, October 09, 2001 9:54 AM To: php-generallists.php.net Subject: [PHP] [BUG?] substr giving strange results

    Ok, either I missed something really simple or ...

    Here's the code:

    $comp = trim($data->comp); $YY = substr($comp,0,3); $MM = substr($comp,5,6); $DD = substr($comp,8,9); echo "COMP is $comp<BR>"; echo "DATE is $YY" . "," . "$MM" . "," . $DD;

    The results are:

    COMP is 2002-10-29 DATE is 200,10-29,29

    Now, shouldn't it be:

    COMP is 2002-10-29 DATE is 2002,10,29

    This exact code snippet works fine one another page but not this one ...

    What is the obvious thing I am not seeing?

    Jc

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

    -- 
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, e-mail: 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:


    Doh!

    Please forget I even asked this question ...

    Jc

    PS yes, I am kicking myself.

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

    attached mail follows:


    Try Active state's Komodo. It lacks certain features like site mapping but these are minor compared to the debugging features you're looking for.

    http://www.activestate.com/Products/Enterprise/ASPN_Komodo/

    Felix ----- Original Message ----- From: "Sander Peters" <S.PetersVisionnet.nl> To: <php-generallists.php.net> Sent: Monday, October 08, 2001 5:16 PM Subject: [PHP] debugging PHP scripts, is that possible?

    > Hello! > > Is it possible to debug PHP scripts? > Is there a tool to do that? (for Windows Platform) > > I really need to run my PHP script "line-by-line" to see what's going > wrong! > > Many thanks in advance for your answer! > > Greetings, > > Sander Peters - The Netherlands > > > -- > 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:


    Using PHPCoder which is free you can debug under windows but the server can be anywhere. The debug module is writte by a russian programmer and works also in another 2 IDEs(MS InterDev and PHPEd).

    -- 
    Andrey Hristov
    Web Developer
    IcyGEN Corporation
    BALANCED SOLUTIONS
    http://www.icygen.com
    

    On Tuesday 09 October 2001 16:04, you wrote: > Try Active state's Komodo. It lacks certain features like site mapping but > these are minor compared to the debugging features you're looking for. > > http://www.activestate.com/Products/Enterprise/ASPN_Komodo/ > > Felix > ----- Original Message ----- > From: "Sander Peters" <S.PetersVisionnet.nl> > To: <php-generallists.php.net> > Sent: Monday, October 08, 2001 5:16 PM > Subject: [PHP] debugging PHP scripts, is that possible? > > > Hello! > > > > Is it possible to debug PHP scripts? > > Is there a tool to do that? (for Windows Platform) > > > > I really need to run my PHP script "line-by-line" to see what's going > > wrong! > > > > Many thanks in advance for your answer! > > > > Greetings, > > > > Sander Peters - The Netherlands > > > > > > -- > > 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:


    From a form, I pass the variables "$q1" and $q2"

    I even print them to the screen to see that they have been passed properly.

    I also pass the following ATTEMPTS on an variable that is an SQL statement:

    INSERT INTO mytable ('$q1', '$q2', '2001-10-09') or INSERT INTO mytable ("$q1", "$q2", "2001-10-09")

    I have tried executing the SQL statement like this:

    $query = $sqlstatement; $result = MYSQL_QUERY($query);

    as well as

    $query = "$sqlstatement"; $result = MYSQL_QUERY($query);

    No matter what I get the values literally "q1" and "q2" sent to the table and NOT their respective values

    :-(

    attached mail follows:


    > >From a form, I pass the variables "$q1" and $q2" > I also pass the following ATTEMPTS on an variable that is an SQL statement: > > INSERT INTO mytable ('$q1', '$q2', '2001-10-09') > or > INSERT INTO mytable ("$q1", "$q2", "2001-10-09") > > I have tried executing the SQL statement like this: > > $query = $sqlstatement; > $result = MYSQL_QUERY($query); > > as well as > > $query = "$sqlstatement"; > $result = MYSQL_QUERY($query); > > > No matter what I get the values literally "q1" and "q2" sent to the table > and NOT their respective values Cause when You pass something from a form thai it is a string (no matter if there's $q1 entered into it and that You have $q1 declared) and it's not interpreted, so the querry contains '$q1', '$q2' strings, not the variables values.

    The solution for You was allready presented:

    do not pass the querry as You did, but like this:

    <INPUT TYPE="whatever" NAME="querry" VALUE="INSERT INTO mytable ('replacer_1', 'replacer_2', '2001-10-09')"> <INPUT TYPE="whatever" NAME="q1" VALUE="some_value_1"> <INPUT TYPE="whatever" NAME="q2" VALUE="some_value_2">

    and handle it:

    $querry = ereg_replace( "replacer_1", $q1, $querry ); $querry = ereg_replace( "replacer_2", $q2, $querry ); $result = MYSQL_QUERY($query);

    Kamil 'Hilarion' Nowicki

    attached mail follows:


    > and handle it: > > $querry = ereg_replace( "replacer_1", $q1, $querry ); > $querry = ereg_replace( "replacer_2", $q2, $querry ); > $result = MYSQL_QUERY($query); Instead of ereg_replace You should even use str_replace() with the same syntaxes (cause it works faster and You do not need ereg_replace() ).

    K'H'N

    attached mail follows:


    post more code, I bet you have either

    $sqlquery = 'INSERT INTO mytable ("$q1", "$q2", "2001-10-09")'; or something strange like $sqlquery = "INSERT INTO mytable ('". $$q1 ."', '". $$q2 ."', '2001-10-09')";

    post more code and we can see for sure.

    --
    

    Chris Lee leemediawaveonline.com

    "Royw" <roydallas61nospam.hotmail.com> wrote in message news:20011009143743.44640.qmailpb1.pair.com... > From a form, I pass the variables "$q1" and $q2" > > I even print them to the screen to see that they have been passed properly. > > I also pass the following ATTEMPTS on an variable that is an SQL statement: > > INSERT INTO mytable ('$q1', '$q2', '2001-10-09') > or > INSERT INTO mytable ("$q1", "$q2", "2001-10-09") > > I have tried executing the SQL statement like this: > > $query = $sqlstatement; > $result = MYSQL_QUERY($query); > > as well as > > $query = "$sqlstatement"; > $result = MYSQL_QUERY($query); > > > No matter what I get the values literally "q1" and "q2" sent to the table > and NOT their respective values > > :-( > >

    attached mail follows:


    "Chris Hobbs" <chobbssilvervalley.k12.ca.us> wrote in message news:3BC2219E.4040505silvervalley.k12.ca.us... > John A. Grant wrote: > > > Are you saying that a site can not be catalogued by a spider > > if if ?var=x syntax is used? So if I put all of the pages in a > > database and used links like this: > > xxx.php?page=1 > > then those pages would all be invisible to the spider? But if > > I use this syntax: > > xxx.php/1 > > then they are visible? > > It's not a matter of can't, it's a matter of won't. Many search engines > won't follow links that are clearly queries (?var=whatever), for good or > ill. Using a pathinfo means of setting vars will generally fool those > engines into visiting everywhere on your site. > > Here's some more info on it: > > http://www.zend.com/zend/spotlight/searchengine.php

    Thanks. That's very timely, because I was just setting up some pages with hardcoded "query" syntax. I will amend my code.

    --
    John A. Grant  * I speak only for myself *  (remove 'z' to reply)
    Radiation Geophysics, Geological Survey of Canada, Ottawa
    If you followup, please do NOT e-mail me a copy: I will read it here
    

    attached mail follows:


    I certainly hate to re-hash this back out, but what about where your link contains named anchors? such as:

    www.domain.com/page.php?read=12&content=34#1200

    will this work in it's place?

    www.domain.com/page.php/read/12/content/34#1200

    At 10:27 AM 10/9/2001 -0400, you wrote: >"Chris Hobbs" <chobbssilvervalley.k12.ca.us> wrote in message >news:3BC2219E.4040505silvervalley.k12.ca.us... > > John A. Grant wrote: > > > > > Are you saying that a site can not be catalogued by a spider > > > if if ?var=x syntax is used? So if I put all of the pages in a > > > database and used links like this: > > > xxx.php?page=1 > > > then those pages would all be invisible to the spider? But if > > > I use this syntax: > > > xxx.php/1 > > > then they are visible? > > > > It's not a matter of can't, it's a matter of won't. Many search engines > > won't follow links that are clearly queries (?var=whatever), for good or > > ill. Using a pathinfo means of setting vars will generally fool those > > engines into visiting everywhere on your site. > > > > Here's some more info on it: > > > > http://www.zend.com/zend/spotlight/searchengine.php > > Thanks. That's very timely, because I was just setting up > some pages with hardcoded "query" syntax. I will amend > my code. > >-- >John A. Grant * I speak only for myself * (remove 'z' to reply) >Radiation Geophysics, Geological Survey of Canada, Ottawa >If you followup, please do NOT e-mail me a copy: I will read it here > > > > > >-- >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:


    I just tested it it on our site, and it works perfectly.

    JSheble wrote:

    > > I certainly hate to re-hash this back out, but what about where your > link contains named anchors? such as: > > www.domain.com/page.php?read=12&content=34#1200 > > will this work in it's place? > > www.domain.com/page.php/read/12/content/34#1200

    -- 
                    _______      ___    _  ____  _____
    Chris Hobbs   / ____\ \    / / |  | |/ ___\|  __ \
    Head Geek    | (___  \ \  / /| |  | | (___ | |  | |
    WebMaster     \___ \  \ \/ / | |  | |\___ \| |  | |
    PostMaster    ____) |  \  /  | |__| |____) | |__| |
                   \____/    \/    \____/ \____/|_____/
                       http://www.silvervalley.k12.ca.us
                           chobbssilvervalley.k12.ca.us
    

    attached mail follows:


    "John A. Grant" <jazrantzsc.nrcan.zc.ca> wrote in message news:20011009143826.46757.qmailpb1.pair.com... > "Chris Hobbs" <chobbssilvervalley.k12.ca.us> wrote in message > news:3BC2219E.4040505silvervalley.k12.ca.us... [...]

    > > http://www.zend.com/zend/spotlight/searchengine.php > > Thanks. That's very timely, because I was just setting up > some pages with hardcoded "query" syntax. I will amend > my code.

    I read the article and I understand it, but I can't get it to work.

    I coded my page using $PATH_INFO but when I tried to access the page with my browser: http://xxx.com/mypage.php/name/john/x/2

    (to retrieve name=john and x=2), I received the following error

    "Warning: Failed opening '/mypage.php/name/john/x/2' for inclusion (include_path='.:/usr/local/php/lib/php') in Unknown on line 0

    The page worked fine when it was: http://xxx.com/mypage.php?name=john&x=2

    More to the point, how does the server know that /john/x/2 is not a directory reference? Is it trying to locate page '2' on the server?

    --
    John A. Grant  * I speak only for myself *  (remove 'z' to reply)
    Radiation Geophysics, Geological Survey of Canada, Ottawa
    If you followup, please do NOT e-mail me a copy: I will read it here
    

    attached mail follows:


    Thanx, I was thinking the named anchor would've been included in the contents of the variable... now that I know it's not, I can start converting my site over to this way... not looking forward to doing that :o)

    One caveat to this method though,you cannot use the $PHP_SELF variable anymore. Gotta use $SCRIPT_NAME. Or is this even accurate... thought I had read that somewhere, but I could be wrong...

    At 09:31 AM 10/9/2001 -0700, Chris Hobbs wrote: >I just tested it it on our site, and it works perfectly. > >JSheble wrote: > >>I certainly hate to re-hash this back out, but what about where your link >>contains named anchors? such as: >>www.domain.com/page.php?read=12&content=34#1200 >>will this work in it's place? >>www.domain.com/page.php/read/12/content/34#1200 > > >-- > _______ ___ _ ____ _____ >Chris Hobbs / ____\ \ / / | | |/ ___\| __ \ >Head Geek | (___ \ \ / /| | | | (___ | | | | >WebMaster \___ \ \ \/ / | | | |\___ \| | | | >PostMaster ____) | \ / | |__| |____) | |__| | > \____/ \/ \____/ \____/|_____/ > http://www.silvervalley.k12.ca.us > chobbssilvervalley.k12.ca.us > > >-- >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:


    thank you very much, ^_^

    attached mail follows:


    > -----Original Message----- > From: Alexander Deruwe [mailto:aderuwe.be] > Sent: Monday, October 08, 2001 10:07 AM > To: PHP General > Subject: JS refering to HTML/PHP arrays > > > Suppose I have these controls on a webpage: > > <input type="text" name="Array[name]"> > <input type="text" name="Array[firstname]"> > > etc ... > > How can I refer to these fields in JavaScript? I've set my stuff > up like this > because it's easy to be able to pass all input as one variable, > but now I'm > stuck here.

    You can always get to all of your variables from the predefined $HTTP_GET_VARS or $HTTP_POST_VARS arrays... so if your form had something like

    <input type='text' name='foo'> <input type='text' name='bar'> <input type='submit'>

    The script it submits to could access $HTTP_GET_VARS["foo"] and $HTTP_GET_VARS["bar"] (or $HTTP_POST_VARS["FOO"], etc, depending on what the <form> tag's method attribute is.) That would take care of the JavaScript problem while still providing one array for all the form variables.

    -Andy

    attached mail follows:


    try this one date("Y-m-d",time()-24*3600);

    --
    Hidulf
    http://www.hidulf.com
    "Sc" <svengstar.com.au> wrote in message
    news:20011009024925.7474.qmailpb1.pair.com...
    > Thanks for the response but it doesn't seem to work for me...
    > This is todays date reference: 2001-10-09
    > And this is meant to be the previous entry in the sql database:
    > 1999-11-29
    >
    >
    > In article <20011008101141.59851.qmailpb1.pair.com>, "Piotr Martyniak"
    > <martyniabox43.gnet.pl> wrote:
    >
    > > use:
    > >   ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $your_data, $numbers);
    > >   $day_before = mktime(0, 0, 0, $numbers[2], $numbers[3], $numbers[1]) -
    > >   24
    > > * 3600;
    > >   $new_date = date("Y/n/j", $day_before);
    > > should work natur
    > >
    > >
    

    attached mail follows:


    On Tue, 09 Oct 2001 12:53:53 +1000, sc wrote: >Thanks for the response but it doesn't seem to work for me... >This is todays date reference: 2001-10-09 >And this is meant to be the previous entry in the sql database: >1999-11-29

    to get the row with the previous date use something like: select * from table where day<$today order by day desc limit 1;

    to select the row with yesterday's date try this: select * from table where day=date_add(curdate(), interval -1 day);

    >In article <20011008101141.59851.qmailpb1.pair.com>, "Piotr >Martyniak" ><martyniabox43.gnet.pl> wrote: > >> use: >> ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $your_data, >>$numbers); >> $day_before = mktime(0, 0, 0, $numbers[2], $numbers[3], >>$numbers[1]) - >> 24 >> * 3600; >> $new_date = date("Y/n/j", $day_before); >> should work natur >> >> >

    -- 
    Mark, maggeletmminternet.com on 10/08/2001
    

    attached mail follows:


    include_once("$DOCUMENT_ROOT/include/sb.inc.php");

    done.

    --
    

    Chris Lee leemediawaveonline.com

    "Christian Dechery" <cdecheryeasynet.com.br> wrote in message news:5.0.0.25.2.20011007191951.01d06eb0pop3.norton.antivirus... > I'm working in quite a BIG system in PHP now... I have up to 6 .inc.php > (library files) so far... > > I have the following directory tree.. > > /vitrine (main program files) > /vitrine/include (include dir, where the .inc.php resides) > /vitrine/adm (the administration panel, with login etc...) > > the problem is that within the files in /adm I do some requires() and > includes()... and within the .inc.php's also... so I'd have something like... > > /vitrine/adm/admin.php > <? > require("../include/lib.inc.php"); > require("../include/error.inc.php"); > // etc... > ?> > > /vitrine/include/lib.inc.php > <? > require_once("../include/db.inc.php"); > // etc... > ?> > > this works fine when I am at /adm... but once I move to /vitrine none of > the includes-within-includes works because of the relative dirs... I can't > use include_path cuz I don't have access to php.ini... what do I do??? > > _____________________________ > . Christian Dechery > . . Gaita-L Owner / Web Developer > . . http://www.webstyle.com.br > . . http://www.tanamesa.com.br >

    attached mail follows:


    $file = fopen($file_name, 'r'); $data = fread($file, filesize($file)); $data = str_replace('visitor', 'something else', $data); $file = fopen($file_name, 'w'); fwrite($file, $data);

    --
    

    Chris Lee leemediawaveonline.com

    "Alawi Albaity" <phpcfyahoo.com> wrote in message news:20011007141602.18411.qmailweb20205.mail.yahoo.com... > I have file and name it file.txt > > the file data is > > ---- > hello ho are vistor > i love the vistor that visit my site > > --- > > > now i want to change a word in my data > this word is : > vistor > > how can i do this ?? > > __________________________________________________ > Do You Yahoo!? > NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. > http://geocities.yahoo.com/ps/info1

    attached mail follows:


    I have a question about a problem I am having on a mysql db. I have inherited a website from someone that I can no longer get in touch with. The website is a smaller version of Monster.com it allows user to submit a resume and search jobs online. I am having errors on it but I am not sure I have it all. Should it have a *.sql file? It has only phtml,inc files also a admin area and all the images.

    I am getting an error on index.phtml of: Warning: Supplied argument is not a valid MySQL result resource in C:sitessitesindex.phtml on line 7

    and : Warning: Supplied argument is not a valid MySQL result resource in C:sitesdocsma.inc on line 7

    line 7 of index is: $copy = mysql_fetch_array($return);

    line 7 of ma.inc: $meta_row = mysql_fetch_array($meta_return);

    Please help . Thanks..

    attached mail follows:


    Hello. We try to make a php-powered WML page. We need to send our own header, and we dont want the default one, header() only adds elements to the header sent, we dont want the header at all, so we can generate our own. Is this possible? PHP 4.0.6

    /Martin

    attached mail follows:


    I guess that is what I get for trusting the documentation in the script instead of the help :)

    I have libjpeg installed (it came installed as part of my installation) and the files are in:

    /usr/lib/libjpeg.so.62.0.0 /usr/lib/libjpeg.so.62 /usr/lib/libjpeg.a /usr/lib/libjpeg.la /usr/lib/libjpeg.so

    however whenever I recompile PHP with either --with-jpeg-dir or --with-jpeg-dir=/usr/lib I still get the same warning message (I recompiled Apache as well) that I was previously getting:

    Warning: ImageCreateFromJpeg: No JPEG support in this PHP build

    Am I not doing something correctly? Do I need to have something else installed? I am really quite confused here.

    TIA! :)

    --Sam

    ----- Original Message ----- From: "Kees Hoekzema" <keestweakers.net> To: "Sam Masiello" <smasiellosynacor.com>; <php-generallists.php.net> Sent: Monday, October 08, 2001 8:32 PM Subject: RE: [PHP] GD Question

    > hello, > > from the ./configure --help: > > --with-gd[=DIR] Include GD support (DIR is GD's install dir). > Set DIR to shared to build as a dl, or > shared,DIR to build as a dl and still specify DIR. > --enable-gd-native-ttf GD: Enable TrueType string function in gd > --with-jpeg-dir=DIR GD: Set the path to libjpeg install prefix. > --with-png-dir=DIR GD: Set the path to libpng install prefix. > --with-xpm-dir=DIR GD: Set the path to libXpm install prefix. > --with-freetype-dir=DIR GD: Set the path to freetype2 install prefix. > --with-ttf[=DIR] GD: Include FreeType 1.x support > --with-t1lib[=DIR] GD: Include T1lib support. > > Goodluck :) > > Kees > > > > -----Original Message----- > > From: Sam Masiello [mailto:smasiellosynacor.com] > > Sent: Tuesday, October 09, 2001 2:20 AM > > To: php-generallists.php.net > > Subject: [PHP] GD Question > > > > > > On a page that I am working on, I get the following warning > > message: Warning: ImageCreateFromJpeg: No JPEG support in this > > PHP build. In searching through the manual, someone mentioned > > that this situation calls for a re-compile of PHP including the > > --with-jpeg-dir option. In looking at the configure script, the > > description of this switch is the "JPEG directory for libcpdf." > > Does this mean that I need to download and install libcpdf? Has > > anyone else experienced this and can possibly offer a little > > assistance? TIA! --Sam Masiello > > > > > > > > -- > > 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:


    I've got an email address set up so that is an alias for a PHP script. IE, if you send an email to that particular address, the email is passed off to the script and it reads it in and processes it. All of this is working find and well. I can do a regex on every line to determine who the email was to, from, subject, etc. However, what I am having problems with is that the rest of the email header isn't the same depending on what email client is used to send the email in the first place. So with that in mind, is there any way to tell when the headers stop and the actual body begins?

    Chris

    attached mail follows:


    The header of an email message is separated by a blank line from the body... so as soon as you see a blank line that's the end of the header.

    -philip

    On Tue, 9 Oct 2001, Boget, Chris wrote:

    > I've got an email address set up so that is an alias for a > PHP script. IE, if you send an email to that particular > address, the email is passed off to the script and it reads > it in and processes it. All of this is working find and well. > I can do a regex on every line to determine who the email > was to, from, subject, etc. > However, what I am having problems with is that the > rest of the email header isn't the same depending on what > email client is used to send the email in the first place. So > with that in mind, is there any way to tell when the headers > stop and the actual body begins? > > Chris >

    attached mail follows:


    In article <4040BBE81A9AD411BD27009027887A7C042EF8tiger.wild.net>, Chris.Bogetwild.net (Chris Boget) wrote:

    > rest of the email header isn't the same depending on what > email client is used to send the email in the first place. So > with that in mind, is there any way to tell when the headers > stop and the actual body begins?

    See the relevant RFC: the email headers section is terminated by \r\n\r\n

    -- 
    CC
    

    attached mail follows:


    > I've got an email address set up so that is an alias for a > PHP script. IE, if you send an email to that particular > address, the email is passed off to the script and it reads > it in and processes it. All of this is working find and well. > I can do a regex on every line to determine who the email > was to, from, subject, etc. > However, what I am having problems with is that the > rest of the email header isn't the same depending on what > email client is used to send the email in the first place. So > with that in mind, is there any way to tell when the headers > stop and the actual body begins?

    There's a mime decoding class here (and also now in PEAR):

    http://www.phpguru.org

    --
    Richard Heyes
    "I know not with what weapons World War III will be fought, but World War IV
    will be fought with sticks and stones." - Albert Einstein
    

    attached mail follows:


    this intrigues me... how do you get an email to go to and/or run a PHP script... this opens all kinds of possibilities... what is required for this?

    At 07:19 PM 10/9/2001 +0100, you wrote: > > I've got an email address set up so that is an alias for a > > PHP script. IE, if you send an email to that particular > > address, the email is passed off to the script and it reads > > it in and processes it. All of this is working find and well. > > I can do a regex on every line to determine who the email > > was to, from, subject, etc. > > However, what I am having problems with is that the > > rest of the email header isn't the same depending on what > > email client is used to send the email in the first place. So > > with that in mind, is there any way to tell when the headers > > stop and the actual body begins? > >There's a mime decoding class here (and also now in PEAR): > >http://www.phpguru.org > >-- >Richard Heyes >"I know not with what weapons World War III will be fought, but World War IV >will be fought with sticks and stones." - Albert Einstein > > >-- >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:


    The PHP locale functions work on an older installation of PHP-3.0.12 on RH 6.1, but they don't seem to work in my installation of PHP-4.0.5 on RH 7.0. I've tried both setlocale("LC_TIME","french") as well as setlocale(LC_TIME,"french"). Note that "french" is in the output list of /usr/bin/locale -a in either case.

    Any ideas?

    Thanks, Paul N.

    attached mail follows:


    The key problem I have is that the number of "q1, q2" items is variable - as few as just q1 other times q1, q2, ... q100 - which is why I "build" an SQL statement from the form and then pass it to the script

    I am still sooooo baffled why it is that I can not pass (as a HIDDEN variable from a form): $sqlstatement = "INSERT INTO mytable ('$q1', '$q2', '2001-10-09')"

    NOTE: when viewed in HTML format after being interpretted: <input type="hidden" name="sqlstatement" value="INSERT INTO tdefb4 VALUES ('$q1', '$q2', '2001-10-09')">

    and then go: $query = $sqlstatement; //or "$sqlstatement" $result = MYSQL_QUERY($query);

    "Kamil Nowicki" <hilarionelfin.pl> wrote in message news:00c401c150d0$ff24b560$d101a8c0elfin... > > >From a form, I pass the variables "$q1" and $q2" > > I also pass the following ATTEMPTS on an variable that is an SQL > statement: > > > > INSERT INTO mytable ('$q1', '$q2', '2001-10-09') > > or > > INSERT INTO mytable ("$q1", "$q2", "2001-10-09") > > > > I have tried executing the SQL statement like this: > > > > $query = $sqlstatement; > > $result = MYSQL_QUERY($query); > > > > as well as > > > > $query = "$sqlstatement"; > > $result = MYSQL_QUERY($query); > > > > > > No matter what I get the values literally "q1" and "q2" sent to the table > > and NOT their respective values > Cause when You pass something from a form thai it is a string (no matter if > there's > $q1 entered into it and that You have $q1 declared) and it's not > interpreted, so > the querry contains '$q1', '$q2' strings, not the variables values. > > The solution for You was allready presented: > > do not pass the querry as You did, but like this: > > <INPUT TYPE="whatever" NAME="querry" VALUE="INSERT INTO mytable > ('replacer_1', 'replacer_2', '2001-10-09')"> > <INPUT TYPE="whatever" NAME="q1" VALUE="some_value_1"> > <INPUT TYPE="whatever" NAME="q2" VALUE="some_value_2"> > > and handle it: > > $querry = ereg_replace( "replacer_1", $q1, $querry ); > $querry = ereg_replace( "replacer_2", $q2, $querry ); > $result = MYSQL_QUERY($query); > > Kamil 'Hilarion' Nowicki >

    attached mail follows:


    > The key problem I have is that the number of "q1, q2" items is variable - as > few as just q1 other times q1, q2, ... q100 - which is why I "build" an SQL > statement from the form and then pass it to the script How do You build it? Which part of SQL querry is from a form and which is built? You say that AFTER it's been built it looks like:

    <input type="hidden" name="sqlstatement" value="INSERT INTO tdefb4 VALUES ('$q1', '$q2', '2001-10-09')">

    in HTML?

    > I am still sooooo baffled why it is that I can not pass (as a HIDDEN > variable from a form): > $sqlstatement = "INSERT INTO mytable ('$q1', '$q2', '2001-10-09')" > > NOTE: when viewed in HTML format after being interpretted: > <input type="hidden" name="sqlstatement" value="INSERT INTO tdefb4 VALUES > ('$q1', '$q2', '2001-10-09')"> > > and then go: > $query = $sqlstatement; //or "$sqlstatement" > $result = MYSQL_QUERY($query);

    Cause $q1 and $q2 in $querry aren't variables, but a string. SQL does not understand '$q1' or any other variable and sees it as a text. You have to fill the $querry with those varables values. You can:

    1. When You build Your $querry make it: $querry = "INSERT INTO mytable VALUES ('$q1', '$q2', ... )"; (note the quoting way!!! ) or $querry = "INSERT INTO mytable VALUES ('" . $q1 . "', '" . $q2 . "', ... )"; (result is the same) and get the VALUES of $q1 and $q2 placed into the $querry and pass that querry by a form (those $q1 $q2 variables are now probably needless) and after recieving it from the form pass it as a querry to database. 2. Build a querry without variables values eg. like this: $querry = "INSERT INTO mytable VALUES ('shit_1', 'shit_2', ... )"; put it into a form (and those $q1, $q2 variables), recieve it from the form and fill the variables into this prepared querry by str_replace() or anything else. 3. Build PHP syntax which is able to build $querry: $querry_builder = '<? $querry = "INSERT INTO mytable VALUES (\'$q1\', \'$q2\', ... )"; ?>'; (note the quoting way!!! ) pass it to the form (and the variables): <INPUT TYPE="hidden" NAME="querry_builder" VALUE="<?= url_encode($querry_builder) ?>"> <INPUT TYPE="hidden" NAME="q1" VALUE="<?= $q1 ?>"> <INPUT TYPE="hidden" NAME="q2" VALUE="<?= $q2 ?>"> and when reciewed, interprete it: eval( $querry_builder ); and get the proper querry int $querry variable to use: $result = MYSQL_QUERY( $query );

    That's all I can say for now.

    Kamil 'Hilarion' Nowicki

    attached mail follows:


    My mistake: > 3. Build PHP syntax which is able to build $querry: > $querry_builder = '<? $querry = "INSERT INTO mytable VALUES (\'$q1\', \'$q2\', ... )"; ?>'; should be: > 3. Build PHP syntax which is able to build $querry: > $querry_builder = '$querry = "INSERT INTO mytable VALUES (\'$q1\', \'$q2\', ... )";'; cause eval() allready takes strings as PHP, so they do not have to be '<?' and '?>' escaped.

    K'H'N

    attached mail follows:


    At 11:39 AM -0500 10/9/01, RoyW wrote: >The key problem I have is that the number of "q1, q2" items is variable - as >few as just q1 other times q1, q2, ... q100 - which is why I "build" an SQL >statement from the form and then pass it to the script > >I am still sooooo baffled why it is that I can not pass (as a HIDDEN >variable from a form): >$sqlstatement = "INSERT INTO mytable ('$q1', '$q2', '2001-10-09')" > >NOTE: when viewed in HTML format after being interpretted: ><input type="hidden" name="sqlstatement" value="INSERT INTO tdefb4 VALUES >('$q1', '$q2', '2001-10-09')"> > >and then go: >$query = $sqlstatement; //or "$sqlstatement" >$result = MYSQL_QUERY($query);

    Aha!

    PHP has NO WAY to tell whether the ...('$q1', '$q2', '2001-10-09')... in the $sqlstatement variable is an actual value or something that should be parsed further; the $query = $sqlstatement line doesn't change this a bit.

    You need to investigate the eval() function here; you would do something like

    eval("\$query = $sqlstatement;");

    There are some fine points to deal with in escaping variable names using eval; see http://www.php.net/eval

    Note that passing a query this way is a

    VERY!!!

    BAD!!!

    IDEA!!!

    unless this page is password protected, or used in an intranet by only trusted people; even then, it's probably not a good idea. One could easily hack the form submission to say

    <input type="hidden" name="sqlstatement" value="drop table tdefb4"> or <input type="hidden" name="sqlstatement" value="delete from tdefb4">

    and your data is gone.

    I'm 99.9999999999999% sure there's a better way to do this.

    If you realllly want to do this, you could pass some authentication value - eg, the md5() value of sqlstatement concatenated with some password/username data - and compare these values before the actual query is done; that way, you could be reasonably sure the page hadn't been hacked.

    -steve

    >"Kamil Nowicki" <hilarionelfin.pl> wrote in message >news:00c401c150d0$ff24b560$d101a8c0elfin... >> > >From a form, I pass the variables "$q1" and $q2" >> > I also pass the following ATTEMPTS on an variable that is an SQL >>