OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general-digest-help_at_lists.php.net
Date: Thu Jul 25 2002 - 20:24:55 CDT

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

    php-general Digest 26 Jul 2002 01:24:55 -0000 Issue 1486

    Topics (messages 109491 through 109641):

    Re: automatic job execution
            109491 by: Scott
            109492 by: Paul O'Neil
            109493 by: Paul O'Neil
            109494 by: Scott
            109496 by: Scott

    Re: preg_match() occurence position
            109495 by: lallous
            109502 by: Tech Support
            109621 by: Miguel Cruz

    Re: Help with msql_fetch_array() FIXED ! Now cookie problems :(
            109497 by: Matthew Bielecki
            109498 by: Scott
            109500 by: Alexander Kuznetsov
            109505 by: Matthew Bielecki

    PHP Meetup, how many of you have signed up?
            109499 by: Jay Blanchard
            109503 by: Martin Clifford

    Sessions, how they exist and die
            109501 by: Matt Babineau
            109506 by: Tech Support

    Re: Speeding up PHP or MySQL
            109504 by: David Buerer

    pdf to html
            109507 by: Tyler Longren
            109545 by: Miles Thompson
            109549 by: David Buerer
            109620 by: Miguel Cruz

    Re: Applying XSL to XML with PHP
            109508 by: ctan
            109519 by: Peter Clarke

    String Manipulation
            109509 by: Mike
            109514 by: Bas Jobsen
            109516 by: Tech Support
            109517 by: Mike
            109521 by: Mike
            109535 by: Tech Support
            109536 by: Mike
            109591 by: Dave [Hawk-Systems]

    pulling records from mysql
            109510 by: Tyler Durdin
            109512 by: David Buerer
            109515 by: Martin Clifford
            109527 by: Tech Support
            109542 by: Martin Clifford

    Re: newbie form problem
            109511 by: Analysis & Solutions

    'Previous' 1, 2, 3, 4, etc. 'Next'
            109513 by: ctan
            109518 by: Matt Schroebel

    Paying Job...
            109520 by: Gerard Samuel
            109522 by: Tyler Longren
            109523 by: Martin Clifford
            109525 by: Brent Baisley
            109526 by: Tyler Longren
            109528 by: Peter J. Schoenster
            109529 by: Paul Maine
            109530 by: Dave [Hawk-Systems]
            109531 by: Matt Babineau
            109532 by: Jay Blanchard
            109533 by: Lowell Allen
            109534 by: David Buerer
            109541 by: Chris Wesley
            109547 by: Bret L Conard
            109614 by: David Freeman

    Re: arrays, variables, and register_globals--solved--thank you
            109524 by: Matthew K. Gold

    New way to make select boxes auto select
            109537 by: Nathan Cook
            109557 by: 1LT John W. Holmes
            109558 by: Johnson, Kirk
            109559 by: Matt Schroebel
            109567 by: Nathan Cook
            109568 by: Nathan Cook
            109579 by: Matt Schroebel
            109632 by: Roger Thomas

    Re: web-based survey form design : PHP & MySQL
            109538 by: Analysis & Solutions

    Re: Traversing an appendable file
            109539 by: Analysis & Solutions

    FreeBSD 4.6 / PHP 4.2.2 / Apache 2.0.39 install trouble
            109540 by: Chad Day
            109548 by: Tech Support
            109563 by: Danny Shepherd
            109572 by: Chad Day

    an array_key_exists() substitute for php 4.0> <4.1 ?
            109543 by: David D
            109546 by: Bas Jobsen
            109550 by: Tech Support

    Re: secure sockets
            109544 by: Josh Levine
            109618 by: Josh Levine

    Re: datetime field - still a newbie
            109551 by: Alexander Ross

    Re: Where do I specify a DSN?
            109552 by: Andrew Hill

    Re: Using PHP to access a Microsoft SQL server
            109553 by: Andrew Hill

    Re: [GURU] PHP w/ Informix DB ISQL 7.20 and Dynamic server 7.30
            109554 by: Andrew Hill
            109566 by: Fernando Ortiz

    Re: ODBC Failures
            109555 by: Andrew Hill

    Re: Where do I specify a DSN? v0.2
            109556 by: Andrew Hill

    patch of php
            109560 by: Hong Tian
            109596 by: Greg Donald
            109610 by: Hong Tian

    I didnt understand the how work pathtovars, a php gpl script
            109561 by: David D
            109564 by: Bret L Conard
            109565 by: David D
            109608 by: David D

    Download not available
            109562 by: David Busby

    mySQL Queries using PHP's SESSION variables
            109569 by: Anup
            109575 by: Kevin Stone
            109577 by: Tech Support
            109595 by: Analysis & Solutions

    GD Library
            109570 by: Ryan Moore
            109581 by: Tech Support
            109582 by: Jay Blanchard
            109584 by: Matt Babineau
            109590 by: Jadiel Flores
            109597 by: Mitja Stepan

    Implement PHP within a string
            109571 by: Joshua E Minnie
            109578 by: Kevin Stone

    Help! mysql problem
            109573 by: Scott Aikin

    printing results from mysql fetch array
            109574 by: Tyler Durdin
            109580 by: Richard Baskett
            109583 by: Kevin Stone

    Re: best way to log bad email address'
            109576 by: Manuel Lemos

    suppressing errors
            109585 by: Preston Wade
            109593 by: 1LT John W. Holmes
            109605 by: Preston Wade
            109607 by: 1LT John W. Holmes

    HOWTO: ODBC-PHP-Apache2
            109586 by: Andrew Hill

    Sessions : overriding variable values
            109587 by: Petre
            109604 by: Scott Fletcher

    OT project dev prroces was .. Paying Job...
            109588 by: Peter J. Schoenster

    conditional image generation problem
            109589 by: Alex Maslov

    For all those trying to compile PHP 4.2.x with Apache 2.0.39 !!!!!
            109592 by: Aaron Gould

    Re: Reg exp to remove line feeds before lines starting with white space
            109594 by: Analysis & Solutions
            109624 by: Miguel Cruz
            109627 by: Analysis & Solutions

    unset array here?
            109598 by: Bas Jobsen
            109613 by: Analysis & Solutions

    two php.ini on windows????
            109599 by: Scott Fletcher
            109602 by: Peter
            109603 by: Christoph Grottolo
            109606 by: Christoph Grottolo
            109609 by: Scott Fletcher
            109611 by: Scott Fletcher

    Parse error - new set of eyes?
            109600 by: Jas
            109601 by: Scott Fletcher
            109612 by: Analysis & Solutions
            109622 by: Nick Oostveen
            109623 by: 1LT John W. Holmes

    timestamp triggered only on update?
            109615 by: Ragnar
            109616 by: Monty
            109619 by: Ragnar

    MSDE with PHP 4
            109617 by: Lee

    Help invoking a regexp
            109625 by: Nicklas af Ekenstam

    Re: GD Library for Windows
            109626 by: Mikey

    Re: Need regular match help - possibly
            109628 by: Mike

    slow reading from socket
            109629 by: Mike

    Re: install issues on Solaris
            109630 by: Peter

    Re: Selecting databases
            109631 by: Mike

    pdflib, NEED HELP with function problem (newby)
            109633 by: Jeffrey

    Problem with HTTP_POST_VARS
            109634 by: bob
            109635 by: Jason Reid
            109636 by: bob

    How to defeat winroute [proxy]?
            109637 by: Evgeny Chuykov

    PHP, MySQL & multiple commands??
            109638 by: Jason Caldwell
            109641 by: 1LT John W. Holmes

    Re: Newman Asks, Do i have to use session_name('sid') every...
            109639 by: Justin French

    Re: Sockets with windows / win32 - 'call to undefined function: ...'
            109640 by: Mike

    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:


    On second thought, do you just want the script to run and sleep or
    actually schedule it as a job? You could just use sleep().

    set_time_out(0);

    while ($i = 0){
            your code

            sleep(60);
    }

    We use this at my company for a file parsing program, it runs, sleeps 15
    minutes and repeats.

    -Scott

    On Thu, 25 Jul 2002, Paul O'Neil wrote:

    > I have a php script I would like run like a cron job every so many minutes.
    > How is this done?
    >
    >
    >

    attached mail follows:


    I looked at some old posts and I found #!/usr/local/bin/php -q should be
    included at the top of the script but I don't think I have permission on the
    system I'm on.

    -----Original Message-----
    From: Scott [mailto:scottscottah.com]
    Sent: Thursday, July 25, 2002 6:25 AM
    To: Paul O'Neil
    Cc: php-generallists.php.net
    Subject: Re: [PHP] automatic job execution

    On second thought, do you just want the script to run and sleep or
    actually schedule it as a job? You could just use sleep().

    set_time_out(0);

    while ($i = 0){
            your code

            sleep(60);
    }

    We use this at my company for a file parsing program, it runs, sleeps 15
    minutes and repeats.

    -Scott

    On Thu, 25 Jul 2002, Paul O'Neil wrote:

    > I have a php script I would like run like a cron job every so many
    minutes.
    > How is this done?
    >
    >
    >

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

    attached mail follows:


    awe shit, that did work. thanks!

    -----Original Message----- From: Scott [mailto:scottscottah.com] Sent: Thursday, July 25, 2002 6:25 AM To: Paul O'Neil Cc: php-generallists.php.net Subject: Re: [PHP] automatic job execution

    On second thought, do you just want the script to run and sleep or actually schedule it as a job? You could just use sleep().

    set_time_out(0);

    while ($i = 0){ your code

    sleep(60); }

    We use this at my company for a file parsing program, it runs, sleeps 15 minutes and repeats.

    -Scott

    On Thu, 25 Jul 2002, Paul O'Neil wrote:

    > I have a php script I would like run like a cron job every so many minutes. > How is this done? > > >

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

    attached mail follows:


    In order to run the script from the command line you need the cgi or executable version of PHP. You can have both on the machine, Apache uses mod_php and you use the cgi version for your scripts on the machine.

    On Thu, 25 Jul 2002, Negrea Mihai wrote:

    > and what happens if you restart apache... ? > > On Thursday 25 July 2002 04:25 pm, Scott wrote: > > On second thought, do you just want the script to run and sleep or > > actually schedule it as a job? You could just use sleep(). > > > > set_time_out(0); > > > > while ($i = 0){ > > your code > > > > sleep(60); > > } > > > > We use this at my company for a file parsing program, it runs, sleeps 15 > > minutes and repeats. > > > > -Scott > > > > On Thu, 25 Jul 2002, Paul O'Neil wrote: > > > I have a php script I would like run like a cron job every so many > > > minutes. How is this done? > >

    attached mail follows:


    You can do that or just run the command: /usr/local/bin/php -q name_of_script.php

    If you want to call the script directly by name instead of calling php like that you will need to make to executable and add the # line at the top.

    On Thu, 25 Jul 2002, Paul O'Neil wrote:

    > I looked at some old posts and I found #!/usr/local/bin/php -q should be > included at the top of the script but I don't think I have permission on the > system I'm on. > > -----Original Message----- > From: Scott [mailto:scottscottah.com] > Sent: Thursday, July 25, 2002 6:25 AM > To: Paul O'Neil > Cc: php-generallists.php.net > Subject: Re: [PHP] automatic job execution > > > On second thought, do you just want the script to run and sleep or > actually schedule it as a job? You could just use sleep(). > > set_time_out(0); > > while ($i = 0){ > your code > > sleep(60); > } > > We use this at my company for a file parsing program, it runs, sleeps 15 > minutes and repeats. > > -Scott > > > > On Thu, 25 Jul 2002, Paul O'Neil wrote: > > > I have a php script I would like run like a cron job every so many > minutes. > > How is this done? > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Yes, I've done it before too...but I saw some other libraries(in other programming langs) that has such features...

    "Justin French" <justinindent.com.au> wrote in message news:B9663510.B4E2%justinindent.com.au... > on 25/07/02 11:05 PM, lallous (phplistlgwm.org) wrote: > > > Yes, I'm aware of the strpos() or any other non-regexp string functions... > > > > but it is either I use regexp to match a certain pattern or I'll have to > > write a char-by-char parser to emulate regexp searching and yet get the > > position of the occurence! > > Actually, I've just written one of them, and they're not that hard, as long > as the sub-set of what you want to do is limited. > > Justin French > >

    attached mail follows:


    How about this:

    $text = "this is test";

    preg_match can return the first match in an optional array I'll call $matches http://www.php.net/manual/en/function.preg-match.php

    preg_match('/test/', $text, $matches);

    strpos returns the numeric position of the first occurrence http://www.php.net/manual/en/function.strpos.php

    $pos = strpos($text, $matches[0]);

    die("$pos"); // should be what you want... 10

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "lallous" <phplistlgwm.org> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 7:40 AM Subject: [PHP] preg_match() occurence position

    > Hello, > > Can I get the starting position of my string occurence when using any > regexps searching functions in PHP ? > > for example: > $mem='this is a test'; > preg_match('/test/', ...) should return me somehow: 10 > > > Thanks > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    On Thu, 25 Jul 2002, lallous wrote: > Yes, I'm aware of the strpos() or any other non-regexp string functions... > > but it is either I use regexp to match a certain pattern or I'll have to > write a char-by-char parser to emulate regexp searching and yet get the > position of the occurence!

    Once you have found the matching string with preg_match, you can use strpos() to see where it was.

    miguel

    attached mail follows:


    Hello again,

    I got the fetch_array problems fixed. I was using the actual server name, when I switched back to localhost everything worked!!

    Now I have a question about how to make cookies work on a Windows machine. This is what I have these parameters set to but it's not working. Do I have slashes/backslashes wrong, or is there something else I have to do in Apache??:

    session.save_path = "C:/Program Files/Apache Group/Apache/web/php/dir/files/temp"

    ; Whether to use cookies. session.use_cookies = 1

    ; Name of the session (used as cookie name). session.name = PHPSESSID

    ; Initialize session on request startup. session.auto_start = 0

    ; Lifetime in seconds of cookie or, if 0, until browser is restarted. session.cookie_lifetime = 0

    ; The path for which the cookie is valid. session.cookie_path = "c:/Program Files/Apache Group/Apache/web/php/dir/files/temp"

    ; The domain for which the cookie is valid. session.cookie_domain = www.mydomain.com

    As always, thanks for your help.

    PHPCoder <internetvsa.co.za> 07/24/02 01:50 PM

    To: Matthew Bielecki <Matthew.Bieleckihobartcorp.com> cc: php-general <php-generallists.php.net> Subject: Re: [PHP] Help with msql_fetch_array()

    I can almost guarantee that it's not the second line that is "failing", the problem here is that $result is not containing naything, and that is normally due to the fact that you are not connecting to the db, or the table "tablename" is not there.

    I use the following format as my "standard" MySQL connect and query snippet:

    $link = mysql_connect("localhost",$username,$password) or die ('Could not connect!'); // suppresses the default error message generated by this function and the "or die()" bit kills the script right then and there should it not be able to connect. mysql_select_db("YOUR_DB_NAME",$link); $sql = "select * from your_table_name"; if ( $result = mysql_query($sql)) { // checks to see if $result contains anything before it even tries to fetch an associative array from it. $row = mysql_fetch_assoc($result); } else { echo "Empty result set!";

    Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9 out of 10 times, you don't need the array element id's that is returned by mysql_fetch_array.

    Matthew Bielecki wrote:

    >I have a couple of scripts that fail with the error of: >Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result >resource in... > >I'm new to both SQL and PHP and I'm wondering if I have some setting >turned off or what. > >Here's the piece of code that is failing (the second line fails): > >$result = mysql_db_query($dbname, "SELECT * FROM tablename ORDER BY id"); > $row = mysql_fetch_array($result); > > >Thanks for your help in advance!! >

    attached mail follows:


    On Thu, 25 Jul 2002, Matthew Bielecki wrote: > session.save_path = "C:/Program Files/Apache > Group/Apache/web/php/dir/files/temp"

    Considering using something like: c:/temp, sure beats typing and remembering that path :)

    How are you setting the cookie in the code?

    attached mail follows:


    Hello Matthew,

    Thursday, July 25, 2002, 5:06:09 PM, you wrote:

    MB> Hello again,

    MB> I got the fetch_array problems fixed. I was using the actual server name, MB> when I switched back to localhost everything worked!!

    MB> Now I have a question about how to make cookies work on a Windows machine. MB> This is what I have these parameters set to but it's not working. Do I MB> have slashes/backslashes wrong, or is there something else I have to do in MB> Apache??:

    MB> session.save_path = "C:/Program Files/Apache MB> Group/Apache/web/php/dir/files/temp"

    MB> ; Whether to use cookies. MB> session.use_cookies = 1

    MB> ; Name of the session (used as cookie name). MB> session.name = PHPSESSID

    MB> ; Initialize session on request startup. MB> session.auto_start = 0

    MB> ; Lifetime in seconds of cookie or, if 0, until browser is restarted. MB> session.cookie_lifetime = 0

    MB> ; The path for which the cookie is valid. MB> session.cookie_path = "c:/Program Files/Apache MB> Group/Apache/web/php/dir/files/temp"

    MB> ; The domain for which the cookie is valid. MB> session.cookie_domain = www.mydomain.com

    try something like this

    session.save_path = c:/Program Files/Apache Group/Apache/web/php/dir/files/temp

    i mean without "..." i had that problem - deleted "" and all is working now

    -- 
    Best regards,
    Alexander Kuznetsov
    

    attached mail follows:


    OH MY GOSH...I ACTUALLY GOT A REAL PROGRAM TO RUN!!!!!!!!!

    Thanks a ton x 1,000,000 Alexander !!!!!!!!!!!!!!!!

    Thanks,

    Matthew J. Bielecki, MCP, A+ Certified Technician Hobart Corporation Field Engineer - Weighing & Network Systems Phone (937) 332-7163 Fax (937) 332-3222 Email Matthew.Bieleckihobartcorp.com

    Alexander Kuznetsov <sanychcstrade.koenig.ru> 07/25/02 10:15 AM Please respond to Alexander Kuznetsov

    To: "Matthew Bielecki" <Matthew.Bieleckihobartcorp.com> cc: php-general <php-generallists.php.net> Subject: Re[2]: [PHP] Help with msql_fetch_array() FIXED ! Now cookie problems :(

    Hello Matthew,

    Thursday, July 25, 2002, 5:06:09 PM, you wrote:

    MB> Hello again,

    MB> I got the fetch_array problems fixed. I was using the actual server name, MB> when I switched back to localhost everything worked!!

    MB> Now I have a question about how to make cookies work on a Windows machine. MB> This is what I have these parameters set to but it's not working. Do I MB> have slashes/backslashes wrong, or is there something else I have to do in MB> Apache??:

    MB> session.save_path = "C:/Program Files/Apache MB> Group/Apache/web/php/dir/files/temp"

    MB> ; Whether to use cookies. MB> session.use_cookies = 1

    MB> ; Name of the session (used as cookie name). MB> session.name = PHPSESSID

    MB> ; Initialize session on request startup. MB> session.auto_start = 0

    MB> ; Lifetime in seconds of cookie or, if 0, until browser is restarted. MB> session.cookie_lifetime = 0

    MB> ; The path for which the cookie is valid. MB> session.cookie_path = "c:/Program Files/Apache MB> Group/Apache/web/php/dir/files/temp"

    MB> ; The domain for which the cookie is valid. MB> session.cookie_domain = www.mydomain.com

    try something like this

    session.save_path = c:/Program Files/Apache Group/Apache/web/php/dir/files/temp

    i mean without "..." i had that problem - deleted "" and all is working now

    -- 
    Best regards,
    Alexander Kuznetsov
    

    attached mail follows:


    Top 10 Locales -- Washington DC (9 members) Amsterdam (7 members) Leeds, UK (7 members) London, England (7 members) Atlanta (5 members) Manhattan (below 42nd St) (5 members) Melbourne (5 members) Oakland-Alameda, CA (4 members) Nashville, TN (4 members) St. Louis, MO (4 members)

    I am somewhat surprised that there are no more developers in Texas signed up. In my area it would just be me and one other. I was hoping to get to see enough to start a users group. There is only a total of 268 signed up world-wide.

    ************************************* * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/ * * No developer is an island ... * *************************************

    attached mail follows:


    I've signed up, and I suppose I would qualify for the Washington, DC area, though that is not strictly the locale I have setup :o)

    As it's new, I'm sure many will be signing up in the coming weeks. Personally, I can hardly wait to sit around and chat with other PHP developers. Sign up now if you haven't all!

    Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/

    >>> "Jay Blanchard" <jay.blanchardniicommunications.com> 07/25/02 10:15AM >>> Top 10 Locales -- Washington DC (9 members) Amsterdam (7 members) Leeds, UK (7 members) London, England (7 members) Atlanta (5 members) Manhattan (below 42nd St) (5 members) Melbourne (5 members) Oakland-Alameda, CA (4 members) Nashville, TN (4 members) St. Louis, MO (4 members)

    I am somewhat surprised that there are no more developers in Texas signed up. In my area it would just be me and one other. I was hoping to get to see enough to start a users group. There is only a total of 268 signed up world-wide.

    ************************************* * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/ * * No developer is an island ... * *************************************

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

    attached mail follows:


    My question is, if I have a user on my web site, and they leave and come back does their session still exist? the file in the /tmp folder exists until it is deleted by the OS? If the user comes back will they get assigned the same session they had before? I know the questions are pretty newbish but I have had experiences in other languages in the past where this is the case. The session cookie stayed in the users browser, so they kept getting the same session and not a new session if they left and came back a day later. Matt Babineau MCWD / CCFD ----------------------------------------- e: <mailto:mattcriticalcode.com> mattcriticalcode.com p: 603.943.4237 w: <http://www.criticalcode.com/> http://www.criticalcode.com PO BOX 601 Manchester, NH 03105

    attached mail follows:


    Hi Matt,

    The user's browser will retain the session cookie as long as it is open unless "session.cookie_lifetime" is set to something other than zero in the php.ini or you can also set it in your script like this:

    // set session cookie to expire in 30 minutes. ini_set("session.cookie_lifetime","1800");

    If they don't close their browser they can leave and come back to your site and still have the same session. In I.E. you can even pop a new browser and the child browser will have the same session cookie as the parent.... feature or bug??? who knows.

    As far as the files in /tmp are concerned... There are two variables that control them in the php.ini

    1) session.gc_maxlifetime 2) session.gc_probability

    if session.gc_maxlifetime is set to 1800 then php will see any files left in /tmp as garbage after 30 minutes. session.gc_probability is a percentual probability that any "garbage" will be deleted. Since any files left in /tmp will be useless to a browser that exceeded our 30 minutes they are not harmful but will need to be culled eventually to keep it from growing forever. If session.gc_probability was set 100 then every single time there was session activity the "garbage" files would be deleted. This could get to be too much extra overhead on a busy server so you could set it to something like 1 so that only every 1 out of a hundred times there was session activity the "garbage" files would be deleted.

    NOTE: if session.gc_maxlifetime is set to something less than session.cookie_lifetime and gc_probability is high (or you just get unlucky and the number comes up) session data on the server could be deleted and the user's browser would still have the old session cookie to a session that no longer exists. This means that the user will not be able to get another session and can make a mess of an ecommerce deal. I believe all three ini variables can be set by user via ini_set and I would strongly recommend taking advantage of that if you are on a shared server and cannot control what's in php.ini. http://www.php.net/manual/en/function.ini-set.php

    Sorry for the book. But sessions can be difficult to grasp if your new and I thought this was important.

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Matt Babineau" <mattcriticalcode.com> To: "'PHP'" <php-generallists.php.net> Sent: Thursday, July 25, 2002 9:15 AM Subject: [PHP] Sessions, how they exist and die

    > My question is, if I have a user on my web site, and they leave and come > back does their session still exist? the file in the /tmp folder exists > until it is deleted by the OS? If the user comes back will they get > assigned the same session they had before? I know the questions are > pretty newbish but I have had experiences in other languages in the past > where this is the case. The session cookie stayed in the users browser, > so they kept getting the same session and not a new session if they left > and came back a day later. > > Matt Babineau > MCWD / CCFD > ----------------------------------------- > e: <mailto:mattcriticalcode.com> mattcriticalcode.com > p: 603.943.4237 > w: <http://www.criticalcode.com/> http://www.criticalcode.com > PO BOX 601 > Manchester, NH 03105 > >

    attached mail follows:


    John,

    You made one comment which is caught my attention:

    > that's a no go :( Or is there a way of storing common query results?

    If the results to a commonly called query are the same for a time period, than why don't you right a routine that just stores the results into a new database that also has a results_expired field. Then, everytime the results are request, you can write a function which checks to see if the results are still valid, if they are, it displays them, if not, it requeries...

    i.e.

    function getresults($common_query) { $query="SELECT results,TIMESTAMP(expired) as dt_expired FROM storedqueries WHERE query=$common_query"; $results=mysql_fetch_object(mysql_query($query)) or error_handler(); if($results->expired <=time()) { //rebuild long slow query and exectue it so that $results has the result of the new query and $query is the query $update_query="INSERT INTO storedqueryies (query,results,expired) VALUES ($query,$results->results,[expired_time) mysql_query($update_query) or error_handler(); }

    return $results->results; }

    -----Original Message----- From: John Holmes [mailto:holmes072000charter.net] Sent: Wednesday, July 24, 2002 6:49 PM To: 'Richard Baskett'; 'PHP General' Subject: RE: [PHP] Speeding up PHP or MySQL

    > Is there anyways to speed up MySQL queries? Or showing the results > through PHP? I have several queries that have about 8 left joins or > so.. Yes very > huge and when you have lots of people using these functions at once it > really slows down.. Are there any practices that you can think of that > would speed up any sql queries? I was thinking of using stored > procedures, but > after a bit of research I found ou= t that MySQL doesn=B9t have that yet > so > that's a no go :( Or is there a way of storing common query results? I > am > looking for _anything_ that will speed up showing results to large > queries..

    How about an index on your tables?

    ---John Holmes...

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

    attached mail follows:


    Hi,

    I've been searching around for ways to convert pdf to html. I haven't had much luck.

    I have a client that has a bunch of pdf's stored in a mysql table. They don't want their users to have to download the pdf file, they want the pdf to be displayed in the web browser all the time. Google has something that allows them to convert pdf to html, so, is it possible for me to do the same?

    These pdf's are graphic intensive...there's not much plain text.

    Thanks everyone, Tyler

    attached mail follows:


    Why not just display the pdf's in the browser? The only caveat is that IE has to be properly patched if 5.5, and there is the minor inconvenience of users having to install the Acrobat Reader. Most people have already done that, so it's practically a non-issue.

    The manual shows how to feed a pdf stored on disk to a browser. I'd imagine extracting and displaying a PDF from a database would be similar to doing the same thing for a .jpg.

    Miles Thompson

    At 10:03 AM 7/25/2002 -0500, Tyler Longren wrote: >Hi, > >I've been searching around for ways to convert pdf to html. I haven't >had much luck. > >I have a client that has a bunch of pdf's stored in a mysql table. >They don't want their users to have to download the pdf file, they want >the pdf to be displayed in the web browser all the time. Google has >something that allows them to convert pdf to html, so, is it possible >for me to do the same? > >These pdf's are graphic intensive...there's not much plain text. > >Thanks everyone, >Tyler > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    I can think of many reasons why displaying the pdf in the browser is a last resort and not a first resort. Especially in situations where the reader is not installed.

    Like Tyler, I would be quite interested to see if anyone has any ideas on how to convert from pdf to html.

    -----Original Message----- From: Miles Thompson [mailto:milesthompsonns.sympatico.ca] Sent: Thursday, July 25, 2002 10:06 AM To: Tyler Longren; php-general Subject: Re: [PHP] pdf to html

    Why not just display the pdf's in the browser? The only caveat is that IE has to be properly patched if 5.5, and there is the minor inconvenience of users having to install the Acrobat Reader. Most people have already done that, so it's practically a non-issue.

    The manual shows how to feed a pdf stored on disk to a browser. I'd imagine extracting and displaying a PDF from a database would be similar to doing the same thing for a .jpg.

    Miles Thompson

    At 10:03 AM 7/25/2002 -0500, Tyler Longren wrote: >Hi, > >I've been searching around for ways to convert pdf to html. I haven't >had much luck. > >I have a client that has a bunch of pdf's stored in a mysql table. They >don't want their users to have to download the pdf file, they want the >pdf to be displayed in the web browser all the time. Google has >something that allows them to convert pdf to html, so, is it possible >for me to do the same? > >These pdf's are graphic intensive...there's not much plain text. > >Thanks everyone, >Tyler > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php

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

    attached mail follows:


    On Thu, 25 Jul 2002, David Buerer wrote: > I can think of many reasons why displaying the pdf in the browser is a last > resort and not a first resort. Especially in situations where the reader is > not installed. > > Like Tyler, I would be quite interested to see if anyone has any ideas on > how to convert from pdf to html.

    It's exceptionally difficult if you want to preserve the graphics.

    miguel

    attached mail follows:


    The XML would be something like this...

    <?xml version="1.0" encoding="UTF-8"?>

    <ARG> <SCHEMESET> <SCHEME> <NAME>Argument from Position to Know</NAME> <FORM> <PREMISE>a is in a position to know whether A is true</PREMISE> <PREMISE>a asserts that A is true</PREMISE> <CONCLUSION>A is true</CONCLUSION> </FORM> <CQ>Is a in a position to know whether A is true?</CQ> <CQ>Is a an honest (trustworthy, reliable) source?</CQ> <CQ>Did a actually assert that A is true?</CQ> </SCHEME> </SCHEMESET> <!-- The Text of the AML--> <TEXT>If any journalists learn about the invasion, then the newspapers will print the news. And if the newspapers print the news, then the invasion will not be a secret. If the invasion is not a secret, then our troops will not have the advantage of surprise. If we do not have the advantage of surprise, then the enemy will be prepared. And if the enemy is prepared, then we are likely to suffer higher casualties. But no journalists learned about the invasion. Therefore, we are not likely to suffer higher casualties.</TEXT> <!-- The components of the argument--> <AU> <PROP identifier="C" missing="no"> <PROPTEXT offset="367">we are likely to suffer higher casualties</PROPTEXT> </PROP> <REFUTATION> <AU> <PROP identifier="A" missing="no"> <PROPTEXT offset="468">we are not likely to suffer higher casualties</PROPTEXT> </PROP> </AU> </REFUTATION> <CA> <AU> <PROP identifier="D" missing="no"> <PROPTEXT offset="304">the enemy will be prepared</PROPTEXT> </PROP> <CA> <AU> <PROP identifier="F" missing="no"> <PROPTEXT offset="202">our troops will not have the advantage of surprise</PROPTEXT> </PROP> <CA> <AU> <PROP identifier="G" missing="no"> <PROPTEXT offset="171">invasion is not a secret</PROPTEXT> </PROP> <LA> <AU> <PROP identifier="I" missing="no"> <PROPTEXT offset="0">If any journalists learn about the invasion</PROPTEXT> </PROP> <REFUTATION> <AU> <PROP identifier="B" missing="no"> <PROPTEXT offset="413"> no journalists learned about the invasion</PROPTEXT> </PROP> </AU> </REFUTATION> </AU> <AU> <PROP identifier="H" missing="no"> <PROPTEXT offset="93">the newspapers print the news</PROPTEXT> </PROP> </AU> </LA> </AU> </CA> </AU> </CA> </AU> </CA> </AU> </ARG>

    Hope this helps...

    chia

    -----Original Message----- From: Peter Clarke [mailto:peterjingo.com] Sent: 25 July 2002 13:06 To: Ctan Cc: php-generallists.php.net Subject: Re: Applying XSL to XML with PHP

    Ctan wrote: > I'm trying to apply XSL to XML stored in a MySQL database with PHP. > How do I go about doing this? I've tried following the example on > php.net but I seem to run into a lot of trouble. Here's how the code > looks like (BTW aml is XML stored in the argument Table): > > > if (! empty($searchword )) > > $query = "SELECT aml FROM arguments WHERE aml LIKE '%$searchword%'"; > $result = mysql_query($query) or die ("Query failed"); > $line = mysql_fetch_array($result, MYSQL_ASSOC); > > // Create an array > $arguments = array('/_xml'=> $line); > > //XSL file > $xsl = "./sheet1.xsl"; > > // Create an XSLT processor > $xslthandler = xslt_create(); > > // Perform the transformation > $html = xslt_process( $xslthandler, 'arg:/_xml', $xsl, NULL, > $arguments); > > // Detect errors > if (!$html) die ('XSLT processing error: '.xslt_error($xslthandler)); > > // Destroy the XSLT processor > xslt_free($xslthandler); > > // Output the resulting HTML > print $html; > > > What I get on the screen is: > > > Array ( [0] => "With the contents of my variable...") > > > And: > > > Warning: Sablotron error on line 1: XML parser error 2: syntax error > in /home/httpd/html/ctan/resultworkingcopy2.php on line 93 XSLT > processing > error: XML parser error 2: syntax error > > > What gives? I really need to solve this urgent. Thanks... > > Chia

    What is the xml. There may be a content encoding problem or some other xml issue.

    Peter

    attached mail follows:


    ctan wrote: > The XML would be something like this... > > <?xml version="1.0" encoding="UTF-8"?> <snip xml>

    Just noticed something... $line = mysql_fetch_array($result, MYSQL_ASSOC); returns an array. Your $arguments array wants a string. So..

    $xml = join($line, ''); $arguments = array('/_xml'=> $xml);

    Peter

    > > Hope this helps... > > chia > > -----Original Message----- > From: Peter Clarke [mailto:peterjingo.com] > Sent: 25 July 2002 13:06 > To: Ctan > Cc: php-generallists.php.net > Subject: Re: Applying XSL to XML with PHP > > > Ctan wrote: > >>I'm trying to apply XSL to XML stored in a MySQL database with PHP. >>How do I go about doing this? I've tried following the example on >>php.net but I seem to run into a lot of trouble. Here's how the code >>looks like (BTW aml is XML stored in the argument Table): >> >> >>if (! empty($searchword )) >> >> $query = "SELECT aml FROM arguments WHERE aml LIKE '%$searchword%'"; >> $result = mysql_query($query) or die ("Query failed"); >> $line = mysql_fetch_array($result, MYSQL_ASSOC); >> >>// Create an array >>$arguments = array('/_xml'=> $line); >> >>//XSL file >>$xsl = "./sheet1.xsl"; >> >>// Create an XSLT processor >>$xslthandler = xslt_create(); >> >>// Perform the transformation >>$html = xslt_process( $xslthandler, 'arg:/_xml', $xsl, NULL, >>$arguments); >> >>// Detect errors >>if (!$html) die ('XSLT processing error: '.xslt_error($xslthandler)); >> >>// Destroy the XSLT processor >>xslt_free($xslthandler); >> >>// Output the resulting HTML >>print $html; >> >> >>What I get on the screen is: >> >> >>Array ( [0] => "With the contents of my variable...") >> >> >>And: >> >> >>Warning: Sablotron error on line 1: XML parser error 2: syntax error >>in /home/httpd/html/ctan/resultworkingcopy2.php on line 93 XSLT >>processing >>error: XML parser error 2: syntax error >> >> >>What gives? I really need to solve this urgent. Thanks... >> >>Chia > > > What is the xml. There may be a content encoding problem or some other > xml issue. > > Peter > > > >

    attached mail follows:


    Hello all, I know that this has probably been discussed before and that you will tell me to go through all the back messages on the list but I really don't have time to do that because I am on a really tight schedule, but I was wondering if anyone could give me some pointers on how to pull some information out of a string. I have something like this: (Something) - is wrong with me or something - (is wrong with me) or something - (is wrong with me

    what I need to know how to do is take the stuff that is inside the Brackets (or partial brackets) and put them into another string the way I am currently doing it is like this: Variable names have been changed per my boss(My Boss wanted me to change them for some reason) <? $parenpos = strpos($tartist,")"); $bracketpos = strpos($tartist,"]"); if($parenpos){ $artist = trim(substr($tartist,0,$parenpos)); $title = trim(substr($tartist,$parenpos+3)); $secondparenpos = strpos($title,"("); $secondbracketpos = strpos($tartist,"["); $title = trim(substr($title,0,$secondparenpos)); }elseif($bracketpos){ $artist = chop(substr($tartist,1,$bracketpos-1)); $title = trim(substr($tartist,$bracketpos+3)); } ?>

    I know that there has to be a shorter version of this, can anyone help me out with it?

    Thank You, Mike funyonfunyon.com mmacraewwnet.net

    attached mail follows:


    Maybe something like: eregi('([a-z]*)( *)(\(*)([a-z]+)( *)(\)*)([a-z]*)',$string,$matches); echo $matches[4];

    Op donderdag 25 juli 2002 17:13, schreef Mike: > Hello all, > I know that this has probably been discussed before and that you will > tell me to go through all the back messages on the list but I really > don't have time to do that because I am on a really tight schedule, but > I was wondering if anyone could give me some pointers on how to pull > some information out of a string. I have something like this: > (Something) - is wrong with me > or > something - (is wrong with me) > or > something - (is wrong with me > > what I need to know how to do is take the stuff that is inside the > Brackets (or partial brackets) and put them into another string > the way I am currently doing it is like this: > Variable names have been changed per my boss(My Boss wanted me to change > them for some reason) > <? > $parenpos = strpos($tartist,")"); > $bracketpos = strpos($tartist,"]"); > if($parenpos){ > $artist = trim(substr($tartist,0,$parenpos)); > $title = trim(substr($tartist,$parenpos+3)); > $secondparenpos = strpos($title,"("); > $secondbracketpos = strpos($tartist,"["); > $title = trim(substr($title,0,$secondparenpos)); > }elseif($bracketpos){ > $artist = chop(substr($tartist,1,$bracketpos-1)); > $title = trim(substr($tartist,$bracketpos+3)); > } > ?> > > I know that there has to be a shorter version of this, can anyone help > me out with it? > > Thank You, > Mike > funyonfunyon.com > mmacraewwnet.net

    attached mail follows:


    I tested this out with success. $string = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', $string);

    ################### // Here is actual working code $string1 = "(Something) - is wrong with me"; $string2 = "something - (is wrong with me)"; $string3 = "something - (is wrong with me"; $string4 = "[something] - is wrong with me"; $string5 = "something - [is wrong with me]"; $string6 = "something - [is wrong with me"; for ($i = 1; $i < 7; $i++) { $data = "string" . $i; $data = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', ${$data}); // the magic line. feed it the string(s). print "<b>$i)</b> $data<br>"; } ###################

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Mike" <funyonfunyon.com> To: "PHP List" <php-generallists.php.net> Sent: Thursday, July 25, 2002 10:13 AM Subject: [PHP] String Manipulation

    > Hello all, > I know that this has probably been discussed before and that you will > tell me to go through all the back messages on the list but I really > don't have time to do that because I am on a really tight schedule, but > I was wondering if anyone could give me some pointers on how to pull > some information out of a string. I have something like this: > (Something) - is wrong with me > or > something - (is wrong with me) > or > something - (is wrong with me > > what I need to know how to do is take the stuff that is inside the > Brackets (or partial brackets) and put them into another string > the way I am currently doing it is like this: > Variable names have been changed per my boss(My Boss wanted me to change > them for some reason) > <? > $parenpos = strpos($tartist,")"); > $bracketpos = strpos($tartist,"]"); > if($parenpos){ > $artist = trim(substr($tartist,0,$parenpos)); > $title = trim(substr($tartist,$parenpos+3)); > $secondparenpos = strpos($title,"("); > $secondbracketpos = strpos($tartist,"["); > $title = trim(substr($title,0,$secondparenpos)); > }elseif($bracketpos){ > $artist = chop(substr($tartist,1,$bracketpos-1)); > $title = trim(substr($tartist,$bracketpos+3)); > } > ?> > > I know that there has to be a shorter version of this, can anyone help > me out with it? > > Thank You, > Mike > funyonfunyon.com > mmacraewwnet.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    Thanks, it worked like a charm ;) Mike

    -----Original Message----- From: Tech Support [mailto:jgrillweb-1hosting.net] Sent: Thursday, July 25, 2002 11:39 AM To: Mike; PHP List Subject: Re: [PHP] String Manipulation

    I tested this out with success. $string = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', $string);

    ################### // Here is actual working code $string1 = "(Something) - is wrong with me"; $string2 = "something - (is wrong with me)"; $string3 = "something - (is wrong with me"; $string4 = "[something] - is wrong with me"; $string5 = "something - [is wrong with me]"; $string6 = "something - [is wrong with me"; for ($i = 1; $i < 7; $i++) { $data = "string" . $i; $data = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', ${$data}); // the magic line. feed it the string(s). print "<b>$i)</b> $data<br>"; } ###################

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Mike" <funyonfunyon.com> To: "PHP List" <php-generallists.php.net> Sent: Thursday, July 25, 2002 10:13 AM Subject: [PHP] String Manipulation

    > Hello all, > I know that this has probably been discussed before and that you will > tell me to go through all the back messages on the list but I really > don't have time to do that because I am on a really tight schedule, but > I was wondering if anyone could give me some pointers on how to pull > some information out of a string. I have something like this: > (Something) - is wrong with me > or > something - (is wrong with me) > or > something - (is wrong with me > > what I need to know how to do is take the stuff that is inside the > Brackets (or partial brackets) and put them into another string > the way I am currently doing it is like this: > Variable names have been changed per my boss(My Boss wanted me to change > them for some reason) > <? > $parenpos = strpos($tartist,")"); > $bracketpos = strpos($tartist,"]"); > if($parenpos){ > $artist = trim(substr($tartist,0,$parenpos)); > $title = trim(substr($tartist,$parenpos+3)); > $secondparenpos = strpos($title,"("); > $secondbracketpos = strpos($tartist,"["); > $title = trim(substr($title,0,$secondparenpos)); > }elseif($bracketpos){ > $artist = chop(substr($tartist,1,$bracketpos-1)); > $title = trim(substr($tartist,$bracketpos+3)); > } > ?> > > I know that there has to be a shorter version of this, can anyone help > me out with it? > > Thank You, > Mike > funyonfunyon.com > mmacraewwnet.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

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

    attached mail follows:


    Ok, It works and everything, but I just was wondering: $data = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', ${$data}); --------------------------------------------------^ ^ what does this do exactly, I see that you are replacing all the characters [] and () but what is the ${$data} for? Also for future reference is there a way that you could return the string with all the parentheses stripped out? Thank You again, Mike Funyonfunyon.com

    And what would be -----Original Message----- From: Tech Support [mailto:jgrillweb-1hosting.net] Sent: Thursday, July 25, 2002 11:39 AM To: Mike; PHP List Subject: Re: [PHP] String Manipulation

    I tested this out with success. $string = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', $string);

    ################### // Here is actual working code $string1 = "(Something) - is wrong with me"; $string2 = "something - (is wrong with me)"; $string3 = "something - (is wrong with me"; $string4 = "[something] - is wrong with me"; $string5 = "something - [is wrong with me]"; $string6 = "something - [is wrong with me"; for ($i = 1; $i < 7; $i++) { $data = "string" . $i; $data = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', ${$data}); // the magic line. feed it the string(s). print "<b>$i)</b> $data<br>"; } ###################

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Mike" <funyonfunyon.com> To: "PHP List" <php-generallists.php.net> Sent: Thursday, July 25, 2002 10:13 AM Subject: [PHP] String Manipulation

    > Hello all, > I know that this has probably been discussed before and that you will > tell me to go through all the back messages on the list but I really > don't have time to do that because I am on a really tight schedule, but > I was wondering if anyone could give me some pointers on how to pull > some information out of a string. I have something like this: > (Something) - is wrong with me > or > something - (is wrong with me) > or > something - (is wrong with me > > what I need to know how to do is take the stuff that is inside the > Brackets (or partial brackets) and put them into another string > the way I am currently doing it is like this: > Variable names have been changed per my boss(My Boss wanted me to change > them for some reason) > <? > $parenpos = strpos($tartist,")"); > $bracketpos = strpos($tartist,"]"); > if($parenpos){ > $artist = trim(substr($tartist,0,$parenpos)); > $title = trim(substr($tartist,$parenpos+3)); > $secondparenpos = strpos($title,"("); > $secondbracketpos = strpos($tartist,"["); > $title = trim(substr($title,0,$secondparenpos)); > }elseif($bracketpos){ > $artist = chop(substr($tartist,1,$bracketpos-1)); > $title = trim(substr($tartist,$bracketpos+3)); > } > ?> > > I know that there has to be a shorter version of this, can anyone help > me out with it? > > Thank You, > Mike > funyonfunyon.com > mmacraewwnet.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

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

    attached mail follows:


    okay... the break down

    the regexp: '(.*(\(|\[)|(\)|\]).*)' .* = any character from zero to infinite number of times (\(|\[) = either ( or [ (they are escaped with a "\" bcz they have other meaning then I have another pipe "|" meaning "or" (\)|\]) = either ) or ] .* = again... any char any # of times if you want only the parenthesis or the brackets removed just leave out the ".*" in the regexp.

    the ${$data}was only there in my example working code bcz I had 6 vars named $string1 through $string6. I wanted to call each of them in a loop but you can't say $string$i. I said $data = "string" . $i., which would translate to just a string like this "string1". I could have just used $$data, which is the same as saying $string1 but I hate to use the double "$$" because it looks bad. Sorry if I threw you off. You can just do it like this:

    $text_out = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', $text_in);

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Mike" <funyonfunyon.com> To: "'Tech Support'" <jgrillweb-1hosting.net>; "PHP List" <php-generallists.php.net> Sent: Thursday, July 25, 2002 10:48 AM Subject: RE: [PHP] String Manipulation

    > Ok, It works and everything, but I just was wondering: > $data = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', ${$data}); > --------------------------------------------------^ ^ > what does this do exactly, I see that you are replacing all the > characters [] and () but what is the ${$data} for? > Also for future reference is there a way that you could return the > string with all the parentheses stripped out? > Thank You again, > Mike > Funyonfunyon.com > > > And what would be > -----Original Message----- > From: Tech Support [mailto:jgrillweb-1hosting.net] > Sent: Thursday, July 25, 2002 11:39 AM > To: Mike; PHP List > Subject: Re: [PHP] String Manipulation > > I tested this out with success. > $string = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', $string); > > ################### > // Here is actual working code > $string1 = "(Something) - is wrong with me"; > $string2 = "something - (is wrong with me)"; > $string3 = "something - (is wrong with me"; > $string4 = "[something] - is wrong with me"; > $string5 = "something - [is wrong with me]"; > $string6 = "something - [is wrong with me"; > for ($i = 1; $i < 7; $i++) > { > $data = "string" . $i; > $data = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', ${$data}); // the > magic > line. feed it the string(s). > print "<b>$i)</b> $data<br>"; > } > ################### > > Jim Grill > Support > Web-1 Hosting > http://www.web-1hosting.net > ----- Original Message ----- > From: "Mike" <funyonfunyon.com> > To: "PHP List" <php-generallists.php.net> > Sent: Thursday, July 25, 2002 10:13 AM > Subject: [PHP] String Manipulation > > > > Hello all, > > I know that this has probably been discussed before and that you will > > tell me to go through all the back messages on the list but I really > > don't have time to do that because I am on a really tight schedule, > but > > I was wondering if anyone could give me some pointers on how to pull > > some information out of a string. I have something like this: > > (Something) - is wrong with me > > or > > something - (is wrong with me) > > or > > something - (is wrong with me > > > > what I need to know how to do is take the stuff that is inside the > > Brackets (or partial brackets) and put them into another string > > the way I am currently doing it is like this: > > Variable names have been changed per my boss(My Boss wanted me to > change > > them for some reason) > > <? > > $parenpos = strpos($tartist,")"); > > $bracketpos = strpos($tartist,"]"); > > if($parenpos){ > > $artist = trim(substr($tartist,0,$parenpos)); > > $title = trim(substr($tartist,$parenpos+3)); > > $secondparenpos = strpos($title,"("); > > $secondbracketpos = strpos($tartist,"["); > > $title = trim(substr($title,0,$secondparenpos)); > > }elseif($bracketpos){ > > $artist = chop(substr($tartist,1,$bracketpos-1)); > > $title = trim(substr($tartist,$bracketpos+3)); > > } > > ?> > > > > I know that there has to be a shorter version of this, can anyone help > > me out with it? > > > > Thank You, > > Mike > > funyonfunyon.com > > mmacraewwnet.net > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > >

    attached mail follows:


    Wow, Thank you for the explanation, it helped out a lot ;) I don't know regex very well, but I hope that this will give me a better understanding of it. Thank you Yet again, Mike

    -----Original Message----- From: Tech Support [mailto:jgrillweb-1hosting.net] Sent: Thursday, July 25, 2002 12:26 PM To: Mike; PHP List Subject: Re: [PHP] String Manipulation

    okay... the break down

    the regexp: '(.*(\(|\[)|(\)|\]).*)' .* = any character from zero to infinite number of times (\(|\[) = either ( or [ (they are escaped with a "\" bcz they have other meaning then I have another pipe "|" meaning "or" (\)|\]) = either ) or ] .* = again... any char any # of times if you want only the parenthesis or the brackets removed just leave out the ".*" in the regexp.

    the ${$data}was only there in my example working code bcz I had 6 vars named $string1 through $string6. I wanted to call each of them in a loop but you can't say $string$i. I said $data = "string" . $i., which would translate to just a string like this "string1". I could have just used $$data, which is the same as saying $string1 but I hate to use the double "$$" because it looks bad. Sorry if I threw you off. You can just do it like this:

    $text_out = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', $text_in);

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Mike" <funyonfunyon.com> To: "'Tech Support'" <jgrillweb-1hosting.net>; "PHP List" <php-generallists.php.net> Sent: Thursday, July 25, 2002 10:48 AM Subject: RE: [PHP] String Manipulation

    > Ok, It works and everything, but I just was wondering: > $data = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', ${$data}); > --------------------------------------------------^ ^ > what does this do exactly, I see that you are replacing all the > characters [] and () but what is the ${$data} for? > Also for future reference is there a way that you could return the > string with all the parentheses stripped out? > Thank You again, > Mike > Funyonfunyon.com > > > And what would be > -----Original Message----- > From: Tech Support [mailto:jgrillweb-1hosting.net] > Sent: Thursday, July 25, 2002 11:39 AM > To: Mike; PHP List > Subject: Re: [PHP] String Manipulation > > I tested this out with success. > $string = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', $string); > > ################### > // Here is actual working code > $string1 = "(Something) - is wrong with me"; > $string2 = "something - (is wrong with me)"; > $string3 = "something - (is wrong with me"; > $string4 = "[something] - is wrong with me"; > $string5 = "something - [is wrong with me]"; > $string6 = "something - [is wrong with me"; > for ($i = 1; $i < 7; $i++) > { > $data = "string" . $i; > $data = ereg_replace('(.*(\(|\[)|(\)|\]).*)', '', ${$data}); // the > magic > line. feed it the string(s). > print "<b>$i)</b> $data<br>"; > } > ################### > > Jim Grill > Support > Web-1 Hosting > http://www.web-1hosting.net > ----- Original Message ----- > From: "Mike" <funyonfunyon.com> > To: "PHP List" <php-generallists.php.net> > Sent: Thursday, July 25, 2002 10:13 AM > Subject: [PHP] String Manipulation > > > > Hello all, > > I know that this has probably been discussed before and that you will > > tell me to go through all the back messages on the list but I really > > don't have time to do that because I am on a really tight schedule, > but > > I was wondering if anyone could give me some pointers on how to pull > > some information out of a string. I have something like this: > > (Something) - is wrong with me > > or > > something - (is wrong with me) > > or > > something - (is wrong with me > > > > what I need to know how to do is take the stuff that is inside the > > Brackets (or partial brackets) and put them into another string > > the way I am currently doing it is like this: > > Variable names have been changed per my boss(My Boss wanted me to > change > > them for some reason) > > <? > > $parenpos = strpos($tartist,")"); > > $bracketpos = strpos($tartist,"]"); > > if($parenpos){ > > $artist = trim(substr($tartist,0,$parenpos)); > > $title = trim(substr($tartist,$parenpos+3)); > > $secondparenpos = strpos($title,"("); > > $secondbracketpos = strpos($tartist,"["); > > $title = trim(substr($title,0,$secondparenpos)); > > }elseif($bracketpos){ > > $artist = chop(substr($tartist,1,$bracketpos-1)); > > $title = trim(substr($tartist,$bracketpos+3)); > > } > > ?> > > > > I know that there has to be a shorter version of this, can anyone help > > me out with it? > > > > Thank You, > > Mike > > funyonfunyon.com > > mmacraewwnet.net > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > >

    attached mail follows:


    >Wow, Thank you for the explanation, it helped out a lot ;) >I don't know regex very well, but I hope that this will give me a better >understanding of it. >Thank you Yet again, >Mike > <clipped regex explanation>

    good luck understanding..... personally it is one of those things that I dust off and pull out the help docs everytime I need it... never use it enough to sit down and really become proficient at writing them, and each time I do it is like pulling teeth. Would love to see a nice walkthrough with excercises and such, just havn't bothered. Instead I suffer through each time it must be used to accomplish an end goal.

    End results from a carefully crafted regex cannot be beat though.

    Dave

    attached mail follows:


    I have a column in my table named firstname with twenty records in it. How can i use php to pull out individual records (say for ex. record 16)? Also, how could i pull out all records upto number 15? Thanks in advance.

    _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com

    attached mail follows:


    Create a column like.....person_id with the auto_incr flag set. Every record will be given a unique id starting at 1 and incrementing by 1 each time. Then you can query based on person_id field to get an individual record

    -----Original Message----- From: Tyler Durdin [mailto:linuxgeek23hotmail.com] Sent: Thursday, July 25, 2002 8:18 AM To: php-generallists.php.net Subject: [PHP] pulling records from mysql

    I have a column in my table named firstname with twenty records in it. How can i use php to pull out individual records (say for ex. record 16)? Also, how could i pull out all records upto number 15? Thanks in advance.

    _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com

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

    attached mail follows:


    You would need to use SQL to identify which columns and rows you need to retrieve, then use various MySQL PHP functions to gather the information.

    For your two queries, they would appear thus, respectively:

    SELECT firstname FROM tablename WHERE id=16

    and

    SELECT firstname FROM tablename ORDER BY id ASC LIMIT 15

    The functions you'll want to look into are mysql_connect(), mysql_select_db(), mysql_query() and mysql_fetch_array(). They can be found at http://www.php.net, do a search for any one of the functions ;o)

    HTH

    Martin

    >>> "Tyler Durdin" <linuxgeek23hotmail.com> 07/25/02 11:18AM >>> I have a column in my table named firstname with twenty records in it. How can i use php to pull out individual records (say for ex. record 16)? Also, how could i pull out all records upto number 15? Thanks in advance.

    _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com

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

    attached mail follows:


    This query will return only the 16th row

    SELECT firstname FROM table_name LIMIT 16, 1

    This query will give you all rows up to 15

    SELECT firstname FROM table_name LIMIT 1, 15

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Tyler Durdin" <linuxgeek23hotmail.com> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 10:18 AM Subject: [PHP] pulling records from mysql

    > I have a column in my table named firstname with twenty records in it. How > can i use php to pull out individual records (say for ex. record 16)? Also, > how could i pull out all records upto number 15? Thanks in advance. > > > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    Yes, that will indeed return the rows specified, but the result is very unstable. By it's nature, MySQL does not have to conform to any sorting method unless you specify it. So it's very good practice when retrieving multiple rows to ALWAYS order them. Just my thoughts :o)

    Martin

    >>> "Tech Support" <jgrillweb-1hosting.net> 07/25/02 12:09PM >>> This query will return only the 16th row

    SELECT firstname FROM table_name LIMIT 16, 1

    This query will give you all rows up to 15

    SELECT firstname FROM table_name LIMIT 1, 15

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Tyler Durdin" <linuxgeek23hotmail.com> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 10:18 AM Subject: [PHP] pulling records from mysql

    > I have a column in my table named firstname with twenty records in it. How > can i use php to pull out individual records (say for ex. record 16)? Also, > how could i pull out all records upto number 15? Thanks in advance. > > > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

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

    attached mail follows:


    On Sun, Jul 21, 2002 at 03:50:15PM -0500, Richard Lynch wrote: > > if (!$MailFromAddress) { > > This should probably be: > > if (!isset($MailFromAddress) || !$MailFromAddress)){

    Or better:

    if ( empty($MailFromAddress) ) {

    --Dan

    -- 
                   PHP classes that make web design easier
            SQL Solution  |   Layout Solution   |  Form Solution
        sqlsolution.info  | layoutsolution.info |  formsolution.info
     T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
     4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
    

    attached mail follows:


    I seem to have a problem getting the page to display beyond the limit if a page, i.e. if the limit if 10 rows in a page I'll only get the 1st ten rows and then a link to further rows but when I chick on them they give me nothing. Here's the code:

    $searchword = $_POST['searchword']; print "Your word(s) is/are: <b>$searchword</b><p>\n\n";

    // Searching by keyword if (! empty($searchword )){ $max = 0; $query = "SELECT aml FROM arguments WHERE aml LIKE '%$searchword%'"; $result1 = mysql_query($query) or die ("Query failed");

    // Determine the number of items containing the $searchword while ($line1 = mysql_fetch_array($result1)){ $max++; }

    // The number of results to be displayed on screen $maxresult = 10;

    $sql_text = "SELECT aml FROM arguments WHERE aml LIKE '%$searchword%'";

    // When the current page is yet to be determined if (!$page) { $page = 1; } $backpage = $page - 1; $nextpage = $page + 1; $result2 = mysql_query($sql_text); $start = ($maxresult * $page) - $maxresult; $num_rows = mysql_num_rows($result2);

    // When the query returns less or equal number of rows than the limit set by $maxresult if ($num_rows <= $maxresult) { $num_pages = 1; }

    // When the query returns the exact limit set by $maxresult else if (($num_rows % $maxresult) == 0) { $num_pages = ($num_rows / $maxresult); }

    // For any other cases... else { $num_pages = ($num_rows / $maxresult) + 1; }

    // Declared as an integer $num_pages = (int) $num_pages;

    // The current page is greater than the total number of pages or // the current page is less than 0 if (($page > $num_pages) || ($page < 0)) { error("You have specified an invalid page number"); }

    // Set the limit per page $sql_text = $sql_text . " LIMIT $start, $maxresult"; $result2 = mysql_query($sql_text);

    // The navigation between pages // Ensure only display when total number of return results exceeds $maxresult // i.e. will not display if only 1 page if ($max>$maxresult){ print "<center>- "; if ($backpage) { print "<a href=\"$PHP_SELF?searchword=$searchword&page=$backpage\">Prev</a>"; }

    // If its the first page; have 'Prev' un-clickable else { print "Prev"; }

    for ($i = 1; $i <= $num_pages; $i++) { if ($i != $page) { print " <a href=\"$PHP_SELF?searchword=$searchword&page=$i\">$i</a> "; } else { print " $i "; } } if ($page != $num_pages) { print "<a href=\"$PHP_SELF?searchword=$searchword&page=$nextpage\">Next</a> -"; } else { print "Next -"; } print "</center>"; }

    print "<table border=\"1\"><th BGCOLOR=\"#ff0000\">Results</th>"; while ($line = mysql_fetch_array($result2, MYSQL_ASSOC)) { print "\t<tr BGCOLOR=\"#000080\">\n"; // The different color, in this case light blue will show that // the particular table belong to search by keywords foreach ($line as$col_value) { print "\t\t<td>$col_value</td>\n"; } print "\t</tr>\n"; }

    }

    I suspect the problem is because I set the limits to a page and thus anything more is ignored. That particular area of code is highlighted in red. Could anyone please tell me where I have gone wrong and how I can fix this. Thank you loads in advance. Incidentally this will be use php script to conduct search of a database, whereby the user inputs a 'searchword' to look for in a HTML form and the php script which processes the form input.

    Chia

    attached mail follows:


    > -----Original Message----- > From: ctan [mailto:ctancomputing.dundee.ac.uk] > Sent: Thursday, July 25, 2002 11:24 AM > To: php-generallists.php.net > Subject: [PHP] 'Previous' 1, 2, 3, 4, etc. 'Next' > > > I seem to have a problem getting the page to display beyond > the limit if a > page, i.e. if the limit if 10 rows in a page I'll only get > the 1st ten rows > and then a link to further rows but when I chick on them they give me > nothing. Here's the code: > > > $searchword = $_POST['searchword']; > print "Your word(s) is/are: <b>$searchword</b><p>\n\n"; > > // Searching by keyword > if (! empty($searchword )){ > $max = 0; > $query = "SELECT aml FROM arguments WHERE aml LIKE > '%$searchword%'"; > $result1 = mysql_query($query) > or die ("Query failed"); > > // Determine the number of items containing the $searchword > while ($line1 = mysql_fetch_array($result1)){ > $max++; > }

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This could just be: $max = mysql_num_rows($result1); --------------------------------------------------- > > > // The number of results to be displayed on screen > $maxresult = 10; > > $sql_text = "SELECT aml FROM arguments WHERE aml LIKE > '%$searchword%'"; > > // When the current page is yet to be determined > if (!$page) { > $page = 1; > }

    ^^^^^^^^^^^^^^^^^^^^^^^ Do you have register_globals on or should you be setting $page = $_GET['page'] here? --------------------------------------------------------

    > > $backpage = $page - 1; > $nextpage = $page + 1; > $result2 = mysql_query($sql_text); > $start = ($maxresult * $page) - $maxresult; > $num_rows = mysql_num_rows($result2); > > // When the query returns less or equal number of rows than > the limit set by > $maxresult > if ($num_rows <= $maxresult) { > $num_pages = 1; > } > > // When the query returns the exact limit set by $maxresult > else if (($num_rows % $maxresult) == 0) { > $num_pages = ($num_rows / $maxresult);

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ You could simplify this here with $num_pages = ceil(($num_rows / $maxresult)); And get rid of the else below ----------------------------------------------

    > } > > // For any other cases... > else { > $num_pages = ($num_rows / $maxresult) + 1; > } > > // Declared as an integer > $num_pages = (int) $num_pages; > > // The current page is greater than the total number of pages or > // the current page is less than 0 > if (($page > $num_pages) || ($page < 0)) { > error("You have specified an invalid page number"); > } > > // Set the limit per page > $sql_text = $sql_text . " LIMIT $start, $maxresult"; > $result2 = mysql_query($sql_text); > > // The navigation between pages > // Ensure only display when total number of return results exceeds > $maxresult > // i.e. will not display if only 1 page > if ($max>$maxresult){ > print "<center>- "; > if ($backpage) { > print "<a > href=\"$PHP_SELF?searchword=$searchword&page=$backpage\">Prev</a>"; > } > > // If its the first page; have 'Prev' un-clickable > else { > print "Prev"; > } > > for ($i = 1; $i <= $num_pages; $i++) { > if ($i != $page) { > > print " <a > href=\"$PHP_SELF?searchword=$searchword&page=$i\">$i</a> "; > } > else { > print " $i "; > } > } > > if ($page != $num_pages) { > print "<a > href=\"$PHP_SELF?searchword=$searchword&page=$nextpage\">Next</a> -"; > } > else { > print "Next -"; > } > print "</center>"; > } > > print "<table border=\"1\"><th BGCOLOR=\"#ff0000\">Results</th>"; > while ($line = mysql_fetch_array($result2, MYSQL_ASSOC)) { > print "\t<tr BGCOLOR=\"#000080\">\n"; > // The different color, in this case > light blue will > show that > // the particular table belong to search by > keywords > foreach ($line as$col_value) { > print > "\t\t<td>$col_value</td>\n"; > } > print "\t</tr>\n"; > } > > > } >

    attached mail follows:


    Basically, someone is looking to get a database driven site built, and Ive never written code for money before. Im looking for advice, as to how the experienced coders in here charge for their work. Do you charge by the page, script or by the hour (that would be nice).

    Thanks for any input you may provide...

    -- 
    Gerard Samuel
    http://www.trini0.org:81/
    http://dev.trini0.org:81/
    

    attached mail follows:


    Charge by which ever will get you the most money.

    tyler

    On Thu, 25 Jul 2002 11:46:38 -0400 Gerard Samuel <gsamtrini0.org> wrote:

    > Basically, someone is looking to get a database driven site built, > and Ive never written code for money before. > Im looking for advice, as to how the experienced coders in here charge > > for their work. > Do you charge by the page, script or by the hour (that would be nice). > > Thanks for any input you may provide... > > -- > Gerard Samuel > http://www.trini0.org:81/ > http://dev.trini0.org:81/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    <<resists the urge to debate ethics>>

    Why didn't you just say, "Charge by whichever will screw the client the worst."? Jesus.

    Martin

    >>> Tyler Longren <tylercaptainjack.com> 07/25/02 11:44AM >>> Charge by which ever will get you the most money.

    tyler

    On Thu, 25 Jul 2002 11:46:38 -0400 Gerard Samuel <gsamtrini0.org> wrote:

    > Basically, someone is looking to get a database driven site built, > and Ive never written code for money before. > Im looking for advice, as to how the experienced coders in here charge > > for their work. > Do you charge by the page, script or by the hour (that would be nice). > > Thanks for any input you may provide... > > -- > Gerard Samuel > http://www.trini0.org:81/ > http://dev.trini0.org:81/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

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

    attached mail follows:


    I have never charge by the page simply because I don't want to be limited in my design. Also, I don't want them saying I've added unneeded pages to up the price. I don't know how you would charge by the script since you should be using object oriented code. Wouldn't this be similar to charging by the page? So that leaves hourly or by the project (not mentioned). Personally, I like to do it by the project, although I am probably a minority in my preference. By the project gives the client a nice set price. However, the scope has to be extremely well defined. It should be anyway, but more so if charging by the project. I then charge by the hour for requests outside the original scope, which happens all the time. It also keeps them in check on their requests. Depending on the client, I require a third or half up front for a project.

    On Thursday, July 25, 2002, at 11:46 AM, Gerard Samuel wrote:

    > Basically, someone is looking to get a database driven site built, > and Ive never written code for money before. > Im looking for advice, as to how the experienced coders in here charge > for their work. > Do you charge by the page, script or by the hour (that would be nice). > > Thanks for any input you may provide... > > -- Gerard Samuel > http://www.trini0.org:81/ > http://dev.trini0.org:81/ > > -- PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    --
    Brent Baisley
    Systems Architect
    Landover Associates, Inc.
    Search & Advisory Services for Advanced Technology Environments
    p: 212.759.6400/800.759.0577
    

    attached mail follows:


    Why even bother charging money if you aren't out to make as much as you can? That's just my point of view.

    tyler

    On Thu, 25 Jul 2002 11:59:28 -0400 "Martin Clifford" <MLC1nrc.gov> wrote:

    > <<resists the urge to debate ethics>> > > Why didn't you just say, "Charge by whichever will screw the client > the worst."? Jesus. > > Martin > > >>> Tyler Longren <tylercaptainjack.com> 07/25/02 11:44AM >>> > Charge by which ever will get you the most money. > > tyler > > On Thu, 25 Jul 2002 11:46:38 -0400 > Gerard Samuel <gsamtrini0.org> wrote: > > > Basically, someone is looking to get a database driven site built, > > and Ive never written code for money before. > > Im looking for advice, as to how the experienced coders in here > > charge > > > > for their work. > > Do you charge by the page, script or by the hour (that would be > > nice). > > > > Thanks for any input you may provide... > > > > -- > > Gerard Samuel > > http://www.trini0.org:81/ > > http://dev.trini0.org:81/ > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    On 25 Jul 2002 at 11:46, Gerard Samuel wrote:

    > Basically, someone is looking to get a database driven site built, > and Ive never written code for money before. > Im looking for advice, as to how the experienced coders in here charge > for their work. Do you charge by the page, script or by the hour (that > would be nice).

    Not talking about what to charge .... but how to charge. Good question.

    I've travelled quite a bit and in a lot of countries a price is "how much do you want to pay". Seriously, when you ask the price the answer is usually that, sometimes excactly that or other times what the seller considers you might pay based on his quick evalution of you.

    Now, are software companies much different than that? I don't think so. Try to get a price on some software "products". Not as easy as it seems.

    What are you really selling? You are not selling "packaged" software. You are selling a service. Most, not all, services get priced by time. I worked at an ad agency and I had to account for 7.75 hours per day. I would attach my time to jobs and the account execs would bill the clients periodically (and sometimes they reduced the time I spent). Often there was the thought to bill for value provided rather than time which is tricky if not also walking an ethical borderline, imho.

    I love the people who bill by the project. They will spend all of 10 minutes to "know" a project and bid. I guess most of them hope to whine later to get more money. I would bet that this method has the most success. But then you would make more money selling drugs than providing software solutions so success is probably not measured by money or acceptance.

    Personally, if it's a small thing like fixing something broken in software I understand or just doing something that's pretty generic I will provide an estimate of time, as in from 4 - 8 hours. The client must trust me and be willing to pay the high figure if need be. I will usually not bill more than the high figure if I've underestimated.

    If it's a project (more than 15 hours) then I prefer to try and get a blueprint going so I can determine what it is I'm going to build before I agree to build it at a price. This worked for me three times, for FedEx and for an Architectural Firm and a "monster" type job company. Usually this method fails because your client will balk at paying for what is "so obvious" :) and when other developers will also agree that it's "so obvious".

    So, imho, it is a question of "who you are" to determine how to charge. Best bet, imho, is to try to understand the project as much as possible and give them a decent range. Be prepared to spend a lot more time on it than you budget. Try to get the job especially since it sounds like it's your first. If they want a fixed price for something which isn't even fixed yet, heck, give it, plenty of others will. Experience helps, understanding the nature of the client helps ... I'd suggest do whatever you have to do to get the job, you want the experience more than the money (possibly).

    Peter

    http://www.coremodules.com/ Web Application Software and Support at Affordable Prices

    attached mail follows:


    In today's depressed IT market, what are the prevailing hourly rates for a very experienced PHP/MySQL developer? I desire to use this information as a guage of what I am currently charging.

    Paul

    -----Original Message----- From: Peter J. Schoenster [mailto:peterschoenster.com] Sent: Thursday, July 25, 2002 11:36 AM To: php-generallists.php.net Subject: Re: [PHP] Paying Job...

    On 25 Jul 2002 at 11:46, Gerard Samuel wrote:

    > Basically, someone is looking to get a database driven site built, > and Ive never written code for money before. > Im looking for advice, as to how the experienced coders in here charge > for their work. Do you charge by the page, script or by the hour (that > would be nice).

    Not talking about what to charge .... but how to charge. Good question.

    I've travelled quite a bit and in a lot of countries a price is "how much do you want to pay". Seriously, when you ask the price the answer is usually that, sometimes excactly that or other times what the seller considers you might pay based on his quick evalution of you.

    Now, are software companies much different than that? I don't think so. Try to get a price on some software "products". Not as easy as it seems.

    What are you really selling? You are not selling "packaged" software. You are selling a service. Most, not all, services get priced by time. I worked at an ad agency and I had to account for 7.75 hours per day. I would attach my time to jobs and the account execs would bill the clients periodically (and sometimes they reduced the time I spent). Often there was the thought to bill for value provided rather than time which is tricky if not also walking an ethical borderline, imho.

    I love the people who bill by the project. They will spend all of 10 minutes to "know" a project and bid. I guess most of them hope to whine later to get more money. I would bet that this method has the most success. But then you would make more money selling drugs than providing software solutions so success is probably not measured by money or acceptance.

    Personally, if it's a small thing like fixing something broken in software I understand or just doing something that's pretty generic I will provide an estimate of time, as in from 4 - 8 hours. The client must trust me and be willing to pay the high figure if need be. I will usually not bill more than the high figure if I've underestimated.

    If it's a project (more than 15 hours) then I prefer to try and get a blueprint going so I can determine what it is I'm going to build before I agree to build it at a price. This worked for me three times, for FedEx and for an Architectural Firm and a "monster" type job company. Usually this method fails because your client will balk at paying for what is "so obvious" :) and when other developers will also agree that it's "so obvious".

    So, imho, it is a question of "who you are" to determine how to charge. Best bet, imho, is to try to understand the project as much as possible and give them a decent range. Be prepared to spend a lot more time on it than you budget. Try to get the job especially since it sounds like it's your first. If they want a fixed price for something which isn't even fixed yet, heck, give it, plenty of others will. Experience helps, understanding the nature of the client helps ... I'd suggest do whatever you have to do to get the job, you want the experience more than the money (possibly).

    Peter

    http://www.coremodules.com/ Web Application Software and Support at Affordable Prices

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

    attached mail follows:


    >I have never charge by the page simply because I don't want to be >limited in my design. Also, I don't want them saying I've added unneeded >pages to up the price.

    or have customers nitpicking about removing pages to cut costs...

    >I don't know how you would charge by the script since you should be >using object oriented code. Wouldn't this be similar to charging by the >page?

    how much code is original these days either... we have a collection of snippets for just about every instance... perhaps only charging the a quarter of the value of the development for an app, but rehashing the code for several other lcients cutting down on development time.

    >So that leaves hourly or by the project (not mentioned). Personally, I >like to do it by the project, although I am probably a minority in my >preference. By the project gives the client a nice set price. However, >the scope has to be extremely well defined. It should be anyway, but

    thats the trick... otherwise the simple aplpication will in teh customer eyes include this, that, and the other thing, despite the 30-50 hours that adds to the developemnt. You can't overstate the boundries of deliverables in a contract.

    >more so if charging by the project. I then charge by the hour for >requests outside the original scope, which happens all the time. It also >keeps them in check on their requests. Depending on the client, I >require a third or half up front for a project.

    good form.

    Always build in some slush factor as well... clients ask for minor this and minor that... if you have built in some slush, you can give them those without additional cost. the more they beat you up on the contract price, the more "slush" you remove, and make them aware that "its all fine, but every little extra will have to be charged now" since theve removed your flexibility.

    Look at it like you aren't doing the development, you are outsourcing it... what is going to ensure that at the end of the project you have enough to pay your developer plus posket a few bucks. Take those steps, and make sure everyone is clear about everything.

    Dave

    attached mail follows:


    When first speaking with a client, would you charge an initial constation fee for lets say conference calls? How would you invoice stuff like this? on a monthly basis? Or every two weeks?

    Matt Babineau MCWD / CCFD ----------------------------------------- e: mattcriticalcode.com p: 603.943.4237 w: http://www.criticalcode.com PO BOX 601 Manchester, NH 03105

    -----Original Message----- From: Peter J. Schoenster [mailto:peterschoenster.com] Sent: Thursday, July 25, 2002 12:36 PM To: php-generallists.php.net Subject: Re: [PHP] Paying Job...

    On 25 Jul 2002 at 11:46, Gerard Samuel wrote:

    > Basically, someone is looking to get a database driven site built, and

    > Ive never written code for money before. Im looking for advice, as to > how the experienced coders in here charge for their work. Do you > charge by the page, script or by the hour (that would be nice).

    Not talking about what to charge .... but how to charge. Good question.

    I've travelled quite a bit and in a lot of countries a price is "how much do you want to pay". Seriously, when you ask the price the answer is usually that, sometimes excactly that or other times what the seller considers you might pay based on his quick evalution of you.

    Now, are software companies much different than that? I don't think so. Try to get a price on some software "products". Not as easy as it seems.

    What are you really selling? You are not selling "packaged" software. You are selling a service. Most, not all, services get priced by time. I worked at an ad agency and I had to account for 7.75 hours per day. I would attach my time to jobs and the account execs would bill the clients periodically (and sometimes they reduced the time I spent). Often there was the thought to bill for value provided rather than time which is tricky if not also walking an ethical borderline, imho.

    I love the people who bill by the project. They will spend all of 10 minutes to "know" a project and bid. I guess most of them hope to whine later to get more money. I would bet that this method has the most success. But then you would make more money selling drugs than providing software solutions so success is probably not measured by money or acceptance.

    Personally, if it's a small thing like fixing something broken in software I understand or just doing something that's pretty generic I will provide an estimate of time, as in from 4 - 8 hours. The client must trust me and be willing to pay the high figure if need be. I will usually not bill more than the high figure if I've underestimated.

    If it's a project (more than 15 hours) then I prefer to try and get a blueprint going so I can determine what it is I'm going to build before I agree to build it at a price. This worked for me three times, for FedEx and for an Architectural Firm and a "monster" type job company. Usually this method fails because your client will balk at paying for what is "so obvious" :) and when other developers will also agree that it's "so obvious".

    So, imho, it is a question of "who you are" to determine how to charge. Best bet, imho, is to try to understand the project as much as possible and give them a decent range. Be prepared to spend a lot more time on it than you budget. Try to get the job especially since it sounds like it's your first. If they want a fixed price for something which isn't even fixed yet, heck, give it, plenty of others will. Experience helps, understanding the nature of the client helps ... I'd suggest do whatever you have to do to get the job, you want the experience more than the money (possibly).

    Peter

    http://www.coremodules.com/ Web Application Software and Support at Affordable Prices

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

    attached mail follows:


    C'mon guys, he asked a legitimate question that most freelancers ask when they start. Here is the starting question;

    How much is your time worth to you? $50 an hour, $200.00 a day, $6000 a month?

    Here is one method;

    a. Estimate how many hours you think that the job will take once you have received ALL RELEVANT INFORMATION so that you can make a true assessment. b. Multiply those hours against your self assessed hourly worth, currently around the lower end of the scale due to your lack of experience. c. Take that total and multiply by 1.3 d. HAVE A CONTRACT!!!! There are many good examples on the web.

    HTH!

    Jay

    "Perhaps you’re diagonally parked in a parallel universe"

    ************************************* * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/ * * No developer is an island ... * *************************************

    attached mail follows:


    > From: Gerard Samuel <gsamtrini0.org> > > Basically, someone is looking to get a database driven site built, > and Ive never written code for money before. > Im looking for advice, as to how the experienced coders in here charge > for their work. > Do you charge by the page, script or by the hour (that would be nice). > > Thanks for any input you may provide... > This is very off-topic, but quickly:

    I find clients are most comfortable paying a flat fee that's presented as part of a detailed proposal. Base the fee on your hourly rate. Make sure the proposal describes EXACTLY what you're going to provide (with additional work at your hourly rate), and include a delivery schedule. If the client has to provide stuff essential to the project, include their delivery dates in the schedule, too. I usually ask for a deposit prior to starting a project (1/3 to 1/2 the total fee). A good proposal protects both you and the client.

    --
    Lowell Allen
    

    attached mail follows:


    And Tyler...rest assured you would never be working for me with an attitude like that. Nor would I ever recommend that you work for one of my clients.

    It's not about making as much as you can, it's about making what is fair, deserved, and reasonable. Someone else said that what we're providing is a service. He's right. First you consult with your clients,then you go sit in a dark room and make it happen. I think that most freelancers will agree that the job is actually about 30% code writing and 70% consultant. Consulting and providing quality service is about relationships, honesty, and ultimatly trust. Trying to rape your clients just because you can will not do any of the above.

    That's just my point of view.....

    -----Original Message----- From: Tyler Longren [mailto:tylercaptainjack.com] Sent: Thursday, July 25, 2002 9:05 AM To: Martin Clifford Cc: php-generallists.php.net Subject: Re: [PHP] Paying Job...

    Why even bother charging money if you aren't out to make as much as you can? That's just my point of view.

    tyler

    On Thu, 25 Jul 2002 11:59:28 -0400 "Martin Clifford" <MLC1nrc.gov> wrote:

    > <<resists the urge to debate ethics>> > > Why didn't you just say, "Charge by whichever will screw the client > the worst."? Jesus. > > Martin > > >>> Tyler Longren <tylercaptainjack.com> 07/25/02 11:44AM >>> > Charge by which ever will get you the most money. > > tyler > > On Thu, 25 Jul 2002 11:46:38 -0400 > Gerard Samuel <gsamtrini0.org> wrote: > > > Basically, someone is looking to get a database driven site built, > > and Ive never written code for money before. Im looking for advice, > > as to how the experienced coders in here charge > > > > for their work. > > Do you charge by the page, script or by the hour (that would be > > nice). > > > > Thanks for any input you may provide... > > > > -- > > Gerard Samuel > > http://www.trini0.org:81/ > > http://dev.trini0.org:81/ > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

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

    attached mail follows:


    On Thu, 25 Jul 2002, Gerard Samuel wrote:

    > Do you charge by the page, script or by the hour (that would be nice).

    It's a tough thing to do, but consider charging by the project. You'll find a most equitable payment/compensation when you establish up front how valuable the project is to the client, and how valuable your time and services are. I find this is the best way to put a client at ease [(s)he knows what (s)he's paying ... no surprises, unless they're client-inspired], and you can concentrate on the project instead of how to make the site fit into X pages or how to justify or fit the project into Y hours.

    Get a couple small projects under your belt, just for the learning experience, and you'll get a good feel for a process that suits your needs.

    Things I did to get become acquainted with a good process: - did small projects for free, just to prove (to the client and myself) that my code and I can survive - did small projects for an undervalued price to get my foot in the door of potential future paying clients, to build a decent portfolio, and to assemble a good list references - did projects just because I love to code and solve problems, not for the cash. (YMMV. There are a myriad of reasons I employ this philosophy, that I won't preach about here.)

    Typically what I try to establish up front: - the total project specs - terms on deliverable(s) (how many stages a project is divided into) - a reasonable estimated time of delivery for each stage, and the project as a whole - documentation requirements - feature-creep clauses (it's such a pain to have the project change in mid-development ... you have to watch your own back for this.) - maintenance requirements (to fix bugs for X number of days/months after delivery ... NOT FOR ADDING FEATURES: do that in separate projects) - compensation/fees - payment terms (25% upon delivery of stage1, 100% by stage3, etc.)

    For FREE projects ... just leave off the last two points. Even though a project may be done pro bono, it should still be relatively chaos-free. A chaotic project done for free will probably just end up being a waste of time for your client, and mostly for you.

    g.luck, ~Chris

    attached mail follows:


    SNIP// So that leaves hourly or by the project (not mentioned). Personally, I like to do it by the project, although I am probably a minority in my preference. By the project gives the client a nice set price. However, the scope has to be extremely well defined. It should be anyway, but more so if charging by the project. I then charge by the hour for requests outside the original scope, which happens all the time. It also keeps them in check on their requests. Depending on the client, I require a third or half up front for a project. //snip Ditto, Ditto and Ditto

    Bret

    Find a contractor or find a contract at Tech-Temp.com

    ----- Original Message ----- From: "Chris Wesley" <cwwesleyudlug.org> To: "php-gen" <php-generallists.php.net> Cc: "Gerard Samuel" <gsamtrini0.org> Sent: Thursday, July 25, 2002 12:45 PM Subject: Re: [PHP] Paying Job...

    > On Thu, 25 Jul 2002, Gerard Samuel wrote: > > > Do you charge by the page, script or by the hour (that would be nice). > > It's a tough thing to do, but consider charging by the project. You'll > find a most equitable payment/compensation when you establish up front how > valuable the project is to the client, and how valuable your time and > services are. I find this is the best way to put a client at ease [(s)he > knows what (s)he's paying ... no surprises, unless they're > client-inspired], and you can concentrate on the project instead of how to > make the site fit into X pages or how to justify or fit the project into Y > hours. > > Get a couple small projects under your belt, just for the learning > experience, and you'll get a good feel for a process that suits your > needs. > > Things I did to get become acquainted with a good process: > - did small projects for free, just to prove (to the client and myself) > that my code and I can survive > - did small projects for an undervalued price to get my foot in the door > of potential future paying clients, to build a decent portfolio, and to > assemble a good list references > - did projects just because I love to code and solve problems, not for the > cash. (YMMV. There are a myriad of reasons I employ this philosophy, > that I won't preach about here.) > > Typically what I try to establish up front: > - the total project specs > - terms on deliverable(s) (how many stages a project is divided into) > - a reasonable estimated time of delivery for each stage, and the project > as a whole > - documentation requirements > - feature-creep clauses (it's such a pain to have the project change > in mid-development ... you have to watch your own back for this.) > - maintenance requirements (to fix bugs for X number of days/months after > delivery ... NOT FOR ADDING FEATURES: do that in separate projects) > - compensation/fees > - payment terms (25% upon delivery of stage1, 100% by stage3, etc.) > > For FREE projects ... just leave off the last two points. Even though a > project may be done pro bono, it should still be relatively chaos-free. > A chaotic project done for free will probably just end up being a waste of > time for your client, and mostly for you. > > g.luck, > ~Chris > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    > Do you charge by the page, script or by the hour (that would > be nice).

    We do this sort of thing in, basically, one of three ways...

    1. Client gives us a budget and we give them a clear idea of what that budget will get them.

    2. Client gives us a good idea of what they want to achieve and we provide a quote to get them there.

    3. Client gives us all the content they have and we go to it and write an invoice for our work when we are done.

    Number 3 is pretty rare. For 1 and 2 we always get approvals on the work as we go and we always work to the budget that we've got (either from their end or from our quoute). Documenting what is covered within the quote is important so that you have a way to increase the invoice if the client comes back asking for added features that were not originally included.

    We've found that most clients like the idea of a fixed fee so they know what they are up for. The key to doing this is to make sure that you don't end up losing out by not making clear what that money will buy.

    CYA, Dave

    attached mail follows:


    Thank you very much, David--you understood the problem exactly and your solution worked perfectly!

    I'd like to add a comment about mysql_data_seek to the php manual entry on mysql_fetch_row, because I would think that this might be a common problem...

    Matt

    ----- Original Message ----- From: David Robley <robleydparadise.net.nz> To: GOLD, MATTHEW <MGOLD1gc.cuny.edu>; <php-generallists.php.net> Sent: Thursday, July 25, 2002 5:37 AM Subject: RE: [PHP-DB] Re: arrays, variables, and register_globals

    > So what you want to do is print a field from the first row extracted from the table, then > loop through all the rows and print several fields? I think you want mysql_data_seek. > > Whenever you do a mysql_fetch_row, php grabs the current row from the result set, and > shifts a pointer to the next record in the result set. In this case it seems you need to > print from the first record, then reset the pointer to the first record and print from all > records found. So: > > $row = mysql_fetch_row ($result)) > print ("$row[4]"); > > mysql_data_seek($result, 0); // Add this > > while ($row = mysql_fetch_row ($result)) > > Unless I misunderstand what you are trying to do.... > > Cheers > -- > David Robley > Temporary Kiwi! > Quod subigo farinam > > "I've been to a film festival in the South of France," said Tom cannily. >

    attached mail follows:


    You may already be doing it like this, but I think I found a new way to make select boxes auto-select (what data they put in) a lot easier. All you have to do is put a variable in each select tag that is equal to the value of the select option i.e.: <option value=teacher $teacher> -- then all you have to do is base the variable on that <select name=interest> $$interest = "selected"; quick and easy with out having to loop through an if elseif statement. Let me know if you like that method or have any objections.

    Full example below.

    print("<select name=interest>\n"); // creates a variable with a name based on // the value of interest with a value of "selected" $$interest = "selected"; print("<option value=>- Select One -</option>\n"); print("<option value=teacher $teacher>Teacher</option>\n"); print("<option value=lego $lego>Lego Enthusiast</option>\n"); print("<option value=student $student>Student</option>\n"); print("<option value=homeschool $homeschool>Homeschool Parent</option>\n"); print("<option value=browsing $browsing>Browsing</option>\n"); print("<option value=afterschool $afterschool>Afterschool</option>\n"); print("<option value=bgca $bgca>Boys & Girls Club</option>\n"); print("<option value=ymca $ymva>YMCA</option>\n"); print("</select>&nbsp;&nbsp;\n");

    [ Nathan Cook | ncookpcsedu.com ]

    attached mail follows:


    Interesting technique. Depending on your error_reporting levels, you may get a bunch of undefined variable warnings, though.

    I usually use a config file with arrays for my select boxes. Something like

    $_CONF['Something'] = array("This","That","And","Something");

    Then just create a function like conf_select($key,$selected); where you pass the $_CONF variable key that you want the select box to be made of and the default value.

    ---John Holmes...

    ----- Original Message ----- From: "Nathan Cook" <ncookpcsedu.com> To: "Php List" <php-generallists.php.net> Cc: "David Chase" <dchasepcsedu.com> Sent: Thursday, July 25, 2002 12:33 PM Subject: [PHP] New way to make select boxes auto select

    > You may already be doing it like this, but I think I found a new way to > make select boxes auto-select (what data they put in) a lot easier. All you > have to do is put a variable in each select tag that is equal to the value > of the select option i.e.: <option value=teacher $teacher> -- then all you > have to do is base the variable on that <select name=interest> $$interest = > "selected"; quick and easy with out having to loop through an if elseif > statement. Let me know if you like that method or have any objections. > > Full example below. > > print("<select name=interest>\n"); > // creates a variable with a name based on > // the value of interest with a value of "selected" > $$interest = "selected"; > print("<option value=>- Select One -</option>\n"); > print("<option value=teacher $teacher>Teacher</option>\n"); > print("<option value=lego $lego>Lego Enthusiast</option>\n"); > print("<option value=student $student>Student</option>\n"); > print("<option value=homeschool $homeschool>Homeschool Parent</option>\n"); > print("<option value=browsing $browsing>Browsing</option>\n"); > print("<option value=afterschool $afterschool>Afterschool</option>\n"); > print("<option value=bgca $bgca>Boys & Girls Club</option>\n"); > print("<option value=ymca $ymva>YMCA</option>\n"); > print("</select>&nbsp;&nbsp;\n"); > > [ Nathan Cook | ncookpcsedu.com ] > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Nathan, this is a new idea to me and very interesting. Do you know what happens here if the error reporting is set to max? Are a bunch of "unitialized variables" warnings issued?

    Thanks for contributing this to the list.

    Kirk

    > -----Original Message----- > From: Nathan Cook [mailto:ncookpcsedu.com] > Sent: Thursday, July 25, 2002 10:34 AM > To: Php List > Cc: David Chase > Subject: [PHP] New way to make select boxes auto select > > > You may already be doing it like this, but I think I found a > new way to > make select boxes auto-select (what data they put in) a lot > easier. All you > have to do is put a variable in each select tag that is equal > to the value > of the select option i.e.: <option value=teacher $teacher> -- > then all you > have to do is base the variable on that <select > name=interest> $$interest = > "selected"; quick and easy with out having to loop through an > if elseif > statement. Let me know if you like that method or have any > objections. > > Full example below. > > print("<select name=interest>\n"); > // creates a variable with a name based on > // the value of interest with a value of "selected" > $$interest = "selected"; > print("<option value=>- Select One -</option>\n"); > print("<option value=teacher $teacher>Teacher</option>\n"); > print("<option value=lego $lego>Lego Enthusiast</option>\n"); > print("<option value=ymca $ymva>YMCA</option>\n"); > print("</select>&nbsp;&nbsp;\n");

    attached mail follows:


    > From: Nathan Cook [mailto:ncookpcsedu.com] > Sent: Thursday, July 25, 2002 12:34 PM > Subject: [PHP] New way to make select boxes auto select > > > You may already be doing it like this, but I think I found a > new way to > make select boxes auto-select (what data they put in) a lot > easier. All you > have to do is put a variable in each select tag that is equal > to the value > of the select option i.e.: <option value=teacher $teacher> -- > then all you > have to do is base the variable on that <select > name=interest> $$interest = > "selected"; quick and easy with out having to loop through an > if elseif > statement. Let me know if you like that method or have any > objections.

    I use these functions which do something similar. The first function accepts an array of names for the option, and returns a string of all of the <options> but not the <select> tags. The ones to be selected have a value of 'selected'. The second function accepts a code table, of say states or provinces, and a value that is to be selected, and returns the <options>. Both are only for single selected values, but could be easily extended. Usage:

    // ------------------------------------------------------------------------------------------- // buildSelect -- return a Select box named $selectName based on key value array $selectArray //<select name="states"> // <?php // $arr = array('MD'=>'selected','DC'=>'','VA'=>''); // echo buildSelect($arr); // ?> // </select> // ------------------------------------------------------------------------------------------- function buildSelect($selectArray) { $str = ''; $count = count($selectArray); for ($i=0;$i<$count;++$i) { list($key,$selected) = each($selectArray[$i]); $selectValue = htmlspecialchars($key); $str .= "<option value=\"$selectValue\" $selected>$key</option>\n"; } return($str); } // ------------------------------------------------------------------------------------------- // setupSelect -- Read table $table from database $db, load all values of $field, and build // a select box from this list named $selName // <select name="states"> // <?php // echo setupSelect($db,'states','stateAbbr','stateName','MD'); // ?> // </select> // ------------------------------------------------------------------------------------------- function setupSelect($db,$table,$field,$orderBy,$value) { $sql = "SELECT " . $field . " from " . $table; if (empty($orderBy)) { $orderBy = $field; } $sql .= " order by " . $orderBy; $result = mysql_query($sql,$db) or die(log_mysql_error($sql,__FILE__,__LINE__)); while ($row = mysql_fetch_array($result)) { $columnData = $row[$field]; if (!empty($columnData)) { $selected = ($columnData == $value ? "selected" : ""); $selArray[] = array($columnData => $selected); } } if (count($selArray) != 0) { return(buildSelect($selArray)); } } // ------------------------------------------------------------------------- // logs to syslog define the constant DISPLAY_MYSQL_ERRORS as 1 // if you want to see errors in browser too // usage: $result = mysql_query($sql,$db) // or die(log_mysql_error($sql,__FILE__,__LINE__)); // ------------------------------------------------------------------------- function log_mysql_error($sql='',$file='',$line=0) { $msg="{$_SERVER['PHP_SELF']}: (FILE=$file) (LINE=$line)\n"; $msg .= "MySQL Says: " . mysql_error() . "\n"; if (!empty($sql)) { $msg .= "SQL Statement was: $sql"; } error_log($msg,0); if (1 == DISPLAY_MYSQL_ERRORS) { $msg=nl2br($msg); echo "<br>$msg<br>\n"; } exit; }

    attached mail follows:


    > // buildSelect -- return a Select box named $selectName based on key value array $selectArray > ... > // $arr = array('MD'=>'selected','DC'=>'','VA'=>'');

    How are you able to quickly and painlessly determine which key gets the selected value, from form submission data, when building the initial array?

    attached mail follows:


    From: "Johnson, Kirk" <kjohnsonzootweb.com> > Do you know what happens here if the error reporting is set to max? > Are a bunch of "unitialized variables" warnings issued?

    That would be my assumption. I suppose you could initialize the variables first to circumvent that. I was more or less looking for a quick and dirty way to accomplish the task.

    However, it looks like some good functions have been submitted to the list which would solve the error reporting. Something along the lines of building an array and then calling a function to loop through the array pieces and build a select menu.

    In my case, I wasn't looking to create another function, just a quick statement.

    attached mail follows:


    > From: Nathan Cook [mailto:ncookpcsedu.com] > Sent: Thursday, July 25, 2002 2:52 PM > Subject: Re: [PHP] New way to make select boxes auto select

    > How are you able to quickly and painlessly determine which > key gets the > selected value, from form submission data, when building the > initial array?

    Via the selected name, say, $POST['location']. I usually use the db code table method and something like: echo setupSelect($db,"locations","LocName","LocName",$_POST['location']);

    If you were using hard coded values like Active, Inactive,etc you can just do a: $status = array('Active','Inactive'); $status[$_POST['status']] = 'selected; echo buildSelect($status);

    It doesn't handle multi selects and it's resulting arrays, but that should be too hard to do by checking if the selected value is an array & modify the comparison in that case.

    attached mail follows:


    i used the same techniqu a while back when i worked with Fast Template. scenario: - present a user with a form to input - there are several text fields and several select options - if there is/are error(s) upon form submission, we will call the same template file and insert proper error messages at appropriate places, normally close to the input field. - we would also luv to make the select option field to DEFAULT to the PREVIOUS value that WAS selected.

    with the technique that Nathan describe below, you can do just that.

    At present i have dropped this technique as I have switched to Smarty. Smarty can do all this with its {html_optios blah blah blah}.

    Recently I made frequent use of Webreference javascript to make select boxes that are related to each other. ie changing(selecting) a left select box would make a right select box change accordingly. I am trying to apply Smarty to this but my javascript knowledge is too shallow. after submitting a form with errors, the 2 select boxes will default back when the script starts. which is NOT what i want. if nebody have done this, appreciate your help.

    --
    roger
    

    --- Nathan Cook <ncookpcsedu.com> wrote: > You may already be doing it like this, but I think I found a new way to > make select boxes auto-select (what data they put in) a lot easier. All you > have to do is put a variable in each select tag that is equal to the value > of the select option i.e.: <option value=teacher $teacher> -- then all you > have to do is base the variable on that <select name=interest> $$interest = > "selected"; quick and easy with out having to loop through an if elseif > statement. Let me know if you like that method or have any objections. > > Full example below. > > print("<select name=interest>\n"); > // creates a variable with a name based on > // the value of interest with a value of "selected" > $$interest = "selected"; > print("<option value=>- Select One -</option>\n"); > print("<option value=teacher $teacher>Teacher</option>\n"); > print("<option value=lego $lego>Lego Enthusiast</option>\n"); > print("<option value=student $student>Student</option>\n"); > print("<option value=homeschool $homeschool>Homeschool Parent</option>\n"); > print("<option value=browsing $browsing>Browsing</option>\n"); > print("<option value=afterschool $afterschool>Afterschool</option>\n"); > print("<option value=bgca $bgca>Boys & Girls Club</option>\n"); > print("<option value=ymca $ymva>YMCA</option>\n"); > print("</select>&nbsp;&nbsp;\n"); > > [ Nathan Cook | ncookpcsedu.com ] > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com

    attached mail follows:


    On Sun, Jul 21, 2002 at 11:57:25AM -0700, Dipendra Raj Subedi wrote: > > first goal of doing one project "Design web-based > survey" using PHP and MySQL. I would appreciate if > anybody give me some links that help to develope such > skills.

    Try the various script archives. Good one is php.resourceindex.com.

    --Dan

    -- 
                   PHP classes that make web design easier
            SQL Solution  |   Layout Solution   |  Form Solution
        sqlsolution.info  | layoutsolution.info |  formsolution.info
     T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
     4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
    

    attached mail follows:


    On Sun, Jul 21, 2002 at 08:50:15PM -0400, Chris Earle wrote: > Is there any way to fseek (or something to the exact same effect) a file > opened with "a" or "a+"? > > I've tried rewinding and fseeking appendable files, but neither work. > > Opening up in "r+" gives me part of the desired result, but if where I want > to write is not at the end, it writes over things, which I obviously do not > want.

    Go to the archives, http://groups.google.com/ and look up the thread on the php-general list entitled "Editing files by line"

    --Dan

    -- 
                   PHP classes that make web design easier
            SQL Solution  |   Layout Solution   |  Form Solution
        sqlsolution.info  | layoutsolution.info |  formsolution.info
     T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
     4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
    

    attached mail follows:


    Simple build, no real complicated configure options (--with-mysql, --with-apxs2..) ..

    During make:

    php_functions.c:93: syntax error *** Error code 1

    Stop in /usr/local/php-4.2.2/sapi/apache2filter.

    etc etc

    Any idea what the problem would be? I googled around for a little and heard there might be problems getting the latest php to work with apache 2.0.39, but that was a couple weeks ago.. I thought the new 4.2.2 build might address it, but I guess if it's only a security fix like the site says, maybe not.. does 4.2.* just not work with Apache 2.0.39, or is something else amiss?

    Thanks, Chad

    attached mail follows:


    4.2.2 will not work with apache 2.X from what I've read. However, I have heard that if you get the latest CVS of both php and apache it will work. I have not, and probably will not, go down that road just yet :-)

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Chad Day" <cdayatpco.com> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 11:38 AM Subject: [PHP] FreeBSD 4.6 / PHP 4.2.2 / Apache 2.0.39 install trouble

    > Simple build, no real complicated configure options > (--with-mysql, --with-apxs2..) .. > > During make: > > php_functions.c:93: syntax error > *** Error code 1 > > Stop in /usr/local/php-4.2.2/sapi/apache2filter. > > etc > etc > > > Any idea what the problem would be? I googled around for a little and heard > there might be problems getting the latest php to work with apache 2.0.39, > but that was a couple weeks ago.. I thought the new 4.2.2 build might > address it, but I guess if it's only a security fix like the site says, > maybe not.. does 4.2.* just not work with Apache 2.0.39, or is something > else amiss? > > Thanks, > Chad > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    Try building apache2 and modphp4 using the FreeBSD ports system - that's how I compiled and it works fine here.

    HTH

    Danny. Apache2.0.39/PHP4.2.2/FreeBSD4.6

    ----- Original Message ----- From: "Chad Day" <cdayatpco.com> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 5:38 PM Subject: [PHP] FreeBSD 4.6 / PHP 4.2.2 / Apache 2.0.39 install trouble

    > Simple build, no real complicated configure options > (--with-mysql, --with-apxs2..) .. > > During make: > > php_functions.c:93: syntax error > *** Error code 1 > > Stop in /usr/local/php-4.2.2/sapi/apache2filter. > > etc > etc > > > Any idea what the problem would be? I googled around for a little and heard > there might be problems getting the latest php to work with apache 2.0.39, > but that was a couple weeks ago.. I thought the new 4.2.2 build might > address it, but I guess if it's only a security fix like the site says, > maybe not.. does 4.2.* just not work with Apache 2.0.39, or is something > else amiss? > > Thanks, > Chad > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    The apache configure line was a vanilla configure, only turning on mod_rewrite and enabling so.

    It's really as basic of a configure as I could do.. I don't understand why it failed. :(

    So I did what someone else suggested, tried the ports.. installed apache2, fine, tried to install mod_php4, selected zlip, mysql, + openldap2.x support. Got the packages, then when installing them and it got to apxs, it was looking for --with-apxs2 since apache 2.x is being used. apparently the script used --with-apxs. I don't see where I can change this.

    Unreal that this is this difficult to get working. :\

    Chad

    -----Original Message----- From: Tech Support [mailto:jgrillweb-1hosting.net] Sent: Thursday, July 25, 2002 2:49 PM To: Chad Day Subject: Re: [PHP] FreeBSD 4.6 / PHP 4.2.2 / Apache 2.0.39 install trouble

    Without seeing exactly what steps you took in building both apache and php it would be next to impossible to guess.

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Chad Day" <cdayatpco.com> To: "Tech Support" <jgrillweb-1hosting.net> Sent: Thursday, July 25, 2002 12:53 PM Subject: RE: [PHP] FreeBSD 4.6 / PHP 4.2.2 / Apache 2.0.39 install trouble

    > Ok, I decided to revert back to 1.3.26. > > PHP builds fine.. > > When I go to start Apache: > > Syntax error on line 205 of /usr/local/www/conf/httpd.conf: > Cannot load /usr/local/www/libexec/libphp4.so into server: > /usr/local/www/libexec/libphp.so: Undefined symbol "core_globals" > > What does that mean? Google turned up 4 results, none relevant, php.net > search turned up 0. > > Thanks, > Chad > > -----Original Message----- > From: Tech Support [mailto:jgrillweb-1hosting.net] > Sent: Thursday, July 25, 2002 1:16 PM > To: Chad Day; php-generallists.php.net > Subject: Re: [PHP] FreeBSD 4.6 / PHP 4.2.2 / Apache 2.0.39 install > trouble > > > 4.2.2 will not work with apache 2.X from what I've read. However, I have > heard that if you get the latest CVS of both php and apache it will work. I > have not, and probably will not, go down that road just yet :-) > > Jim Grill > Support > Web-1 Hosting > http://www.web-1hosting.net > ----- Original Message ----- > From: "Chad Day" <cdayatpco.com> > To: <php-generallists.php.net> > Sent: Thursday, July 25, 2002 11:38 AM > Subject: [PHP] FreeBSD 4.6 / PHP 4.2.2 / Apache 2.0.39 install trouble > > > > Simple build, no real complicated configure options > > (--with-mysql, --with-apxs2..) .. > > > > During make: > > > > php_functions.c:93: syntax error > > *** Error code 1 > > > > Stop in /usr/local/php-4.2.2/sapi/apache2filter. > > > > etc > > etc > > > > > > Any idea what the problem would be? I googled around for a little and > heard > > there might be problems getting the latest php to work with apache 2.0.39, > > but that was a couple weeks ago.. I thought the new 4.2.2 build might > > address it, but I guess if it's only a security fix like the site says, > > maybe not.. does 4.2.* just not work with Apache 2.0.39, or is something > > else amiss? > > > > Thanks, > > Chad > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > >

    attached mail follows:


    hello all,

    I download a gni script path2vars that manipulate query_string for web crawlers. But I have php 4.06 that doesnt support function : uses array_key_exists() (PHP >= 4.1.0). Is there a way to substitude it ? Is there a way to detect php version and incluse the functions or it substitute ?

    Thanks.

    attached mail follows:


    http://www.php.net/manual/en/function.array-key-exists.php: Note: The name of this function is key_exists() in PHP version 4.0.6.

    Op donderdag 25 juli 2002 18:53, schreef David D: > hello all, > > I download a gni script path2vars that manipulate query_string for web > crawlers. > But I have php 4.06 that doesnt support function : > uses array_key_exists() (PHP >= 4.1.0). > Is there a way to substitude it ? > Is there a way to detect php version and incluse the functions or it > substitute ? > > > Thanks.

    attached mail follows:


    http://www.php.net/manual/en/function.array-key-exists.php The name of this function is key_exists() in PHP version 4.0.6.

    Damn those elusive manual pages :-/

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "David D" <ddasi.fr> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 11:53 AM Subject: [PHP] an array_key_exists() substitute for php 4.0> <4.1 ?

    > hello all, > > I download a gni script path2vars that manipulate query_string for web > crawlers. > But I have php 4.06 that doesnt support function : > uses array_key_exists() (PHP >= 4.1.0). > Is there a way to substitude it ? > Is there a way to detect php version and incluse the functions or it > substitute ? > > > Thanks. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    Richard Lynch wrote: > > $hostname = 'ssl://155.246.211.23'; > > You have to be running PHP 4.3.0 (IE, CVS or snapshot) to use 'ssl://' with > fsockopen, according to the manual. > > You may have to use cURL for now, or develop in 4.3.0 and deploy when it's > ready, or...

    I tried mucking around with cURL for a bit, but couldn't figure out a way to use encryption with telnet (not to mention that documentation/example code for the telnet feature is non-existant).

    So, I tried building the the latest snapshot of 4.3.0. Now when I try to use fsockopen(); with ssl:// I receive this message:

    Warning: fsockopen(): no SSL support in this build in /usr/home/research/htdocs/tests/secure2.php4 on line 6

    I did include OpenSSL support...is there something else I need to include?

    --Josh Levine

    attached mail follows:


    Josh Levine wrote:

    > Warning: fsockopen(): no SSL support in this build in > /usr/home/research/htdocs/tests/secure2.php4 on line 6 > > I did include OpenSSL support...is there something else I need to > include?

    Nevermind, I just re-built it from scratch again and it worked. Now I'm just having trouble matching cipher suites, but I think that's more of a Java thing than a PHP thing.

    --Josh Levine

    attached mail follows:


    Thanks bunches

    "John Holmes" <holmes072000charter.net> wrote in message news:001101c233ba$3de3d430$b402a8c0mango... > > I have a datetime field in one of my mysql tables...when displaying > some > > of > > my records I want to display the date in the aforementioned datetime > > field, > > but if the date is today I want to display "today" instead. If the > date > > is > > yesterday I want it to display that .... so I how do I compare the > date in > > my record to todays date? Thanks > > I posted this response earlier...did you get it? Are you looking for a > MySQL solution or a PHP solution?? > > SELECT IF(TO_DAYS(CURDATE()) = > TO_DAYS(date_column),'Today',IF(TO_DAYS(CURDATE())-1 = > TO_DAYS(date_column),'Yesterday',date_column)) FROM your_table; > > If you want a PHP solution, then just select the regular MySQL date > format YYYYMMDD and use something like this when looping through your > results. > > switch($your_row['Date_Column']) > { > case date("Ymd"): > echo "Today"; > break; > case date("Ymd",strtotime("-1 day")): > echo "Yesterday"; > break; > default: > echo $your_row['Date_Column']; > } > > Untested code, of course... > > ---John Holmes... > > >

    attached mail follows:


    Naw, this is Linux :)

    But for anyone searching the archives, the "Data source name not found, and no default driver specified" means one of four things:

    1. you don't have a DSN with the name you are using 2. you don't have a driver where the DSN expects to find it 3. on Windows, you are trying to use a File/User DSN instead of a System DSN. 4. on *nix - you haven't specified your ODBCINI environment variable like: putenv("ODBCINI=/path/to/odbc.ini"); (note LD_LIBRARY_PATH and ODBCINSTINI may have to be defined as well!) Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access & Virtuoso Universal Server

    -----Original Message----- From: Tracker 1 [mailto:tracker1theroughnecks.net] Sent: Wednesday, July 03, 2002 8:28 AM To: php-generallists.php.net Subject: [PHP] Re: Where do I specify a DSN?

    "Richard Lynch" <richphpbootcamp.com> wrote in message... > > I'm getting this error message...where does it come from? > > > >Warning: SQL error: [unixODBC][Driver Manager]Data source name not > >found, and no default driver specified, SQL state IM002 in SQLConnect in > >/var/www/html/index.php on line 4 > > Microsoft. :-) > > Microsoft defines possible database connections as "DSN" in the ODBC Control > Panel. > > Open up the ODBC Control Panel, and make a DSN named "foo" and point it to > the database you want to access.

    it said unixODBC, not sure what he was trying to connect to though, may be best to use the native connection drivers?

    --
    =======================================================================
    Michael J. Ryan  -  tracker1[*at*]theroughnecks.com
    Roughneck BBS: http://www.theroughnecks.net  telnet://theroughnecks.net
    =======================================================================
    Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email
    One program for aim/icq/yahoo/msn/irc  -  http://www.trillian.cc/
    

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

    attached mail follows:


    ODBC can do this directly - no root privs needed.

    http://www.php.net/odbc

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

    -----Original Message----- From: Lazor, Ed [mailto:ELazorprovidence.org] Sent: Wednesday, July 03, 2002 5:12 PM To: php-general Subject: RE: [PHP] Using PHP to access a Microsoft SQL server

    It sounds like you need to give your apache account access to the database. You can test this by logging in as root and running "su - apache". You'll be logged in as Apache; try running the commands you used to test everything when logged in as root. You'll probably get errors that will hopefully lead you to an answer.

    -----Original Message----- From: David Busby [mailto:busbypnts.com] Sent: Wednesday, July 03, 2002 3:01 PM To: php-general Subject: [PHP] Using PHP to access a Microsoft SQL server

    List, Has anyone done this before? I got it to work for my root account on my computer but I cannot get access from my PHP scripts when I run under the "apache" user? What the dilly yo?

    Setup: RH7.3 PHP4 unixODBC freeTDS

    -- 
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php
     
    ************************************************************************
    ****
    This message is intended for the sole use of the individual and entity
    to
    whom it is addressed, and may contain information that is privileged,
    confidential and exempt from disclosure under applicable law.  If you
    are
    not the intended addressee, nor authorized to receive for the intended
    addressee, you are hereby notified that you may not use, copy, disclose
    or
    distribute to anyone the message or any information contained in the
    message.  If you have received this message in error, please immediately
    advise the sender by reply email and delete the message.  Thank you very
    much.
    

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

    attached mail follows:


    Hi Emile,

    Sure, ODBC should work just fine. Let me know if you need info on setting it up.

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

    -----Original Message----- From: Emile Bosch [mailto:emileboschhotmail.com] Sent: Saturday, June 29, 2002 3:08 AM To: php-generallists.php.net Subject: [PHP] [GURU] PHP w/ Informix DB ISQL 7.20 and Dynamic server 7.30

    Hi group,

    I have to automate (read: Put there internal informix db online) an company and they are using this configuration:

    ISQL 7.20 Embedded sql for C. 9.14 4GL 7.30 4GL runtime 7.20 Dynamic server 7.30 Java API 1.05

    Now i was wondering wheter it is possible to make an PHP connection to this DB so that i can query it and use it in PHP. Does someone knows how to do this? Or is it maybe possible to make an ODBC connection or anything like that/

    Warm regards Emile Bosch

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

    attached mail follows:


    Yes sure, You need to install the Informix-CSDK or I-Connect in the machine with the server (download from www.informix.com/evaluate) .

    Configure the files /etc/services and $INFORMIXDIR/sqlhosts. Also add the informix libraries to the LD_LIBRARY_PATH.

    Then configure and make PHP with the --with-informix=$INFORMIXDIR option.

    HTH

    > -----Original Message----- > From: Emile Bosch [mailto:emileboschhotmail.com] > Sent: Saturday, June 29, 2002 3:08 AM > To: php-generallists.php.net > Subject: [PHP] [GURU] PHP w/ Informix DB ISQL 7.20 and Dynamic server > 7.30 > > Hi group, > > I have to automate (read: Put there internal informix db online) an > company > and they are using this configuration: > > ISQL 7.20 > Embedded sql for C. 9.14 > 4GL 7.30 > 4GL runtime 7.20 > Dynamic server 7.30 > Java API 1.05 > > Now i was wondering wheter it is possible to make an PHP connection to > this > DB so that i can query it and use it in PHP. Does someone knows how to > do > this? Or is it maybe possible to make an ODBC connection or anything > like > that/ > > Warm regards > Emile Bosch

    attached mail follows:


    How does it fail?

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

    -----Original Message----- From: David Busby [mailto:busbypnts.com] Sent: Monday, July 01, 2002 4:29 PM To: php-general Subject: [PHP] ODBC Failures

    List, My ODBC connection is failing it seems...I can run this code just fine...odbc_connect and odbc_pconnect seem to work...the odbc_prepare even works just fine...but as soon as I execute (with odbc_execute, odbc_exec, or odbc_do it fails...any ideas?

    <?php

    $db = odbc_pconnect("Desire","sa", "xxxxxxxx"); echo "Database Connection:".$db."<br>"; $sql = odbc_prepare($db, "execute spGetItems"); echo "Prepared SQL id:".$sql."<br>"; // This line will fail $rs = odbc_execute($sql);

    ?>

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

    attached mail follows:


    David,

    The error probably has to do with your PHP environment being unable to locate your odbc.ini file.

    You will need to set your odbc.ini location as well as the location of the driver manager.

    Check out this HOWTO http://www.iodbc.org/odbc-phpHOWTO.html to get an idea of how it all works - the instructions should be similar for UnixODBC.

    Hint - look at the "putenv()" calls.

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

    -----Original Message----- From: David Busby [mailto:busbypnts.com] Sent: Monday, July 01, 2002 2:55 PM To: php-general Subject: [PHP] Where do I specify a DSN? v0.2

    List, Guess I should be more specific:

    Heres line four: $db = odbc_connect("somedsn","sa", "");

    My System: RedHat 7.3/Apache/PHP 4.1.2-7 I'm getting this error message...I think I just need to define the DSN...is that done in /etc/odbc.ini? Or what?

    /B

    Warning: SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /var/www/html/index.php on line 4

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

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

    attached mail follows:


    Hi,

    I download patch of php-4.2.0-to-4.2.2.patch.gz from http://www.php.net and try to update our PHP 4.2.0 to 4.2.2. But I can't find instructions how to update PHP by using this patch of php-4.2.0-to-4.2.2.patch.gz. Could anyone tell me how to patch it or where can I find this information to update PHP by this patch?

    Thanks, Hong

    attached mail follows:


    On Thu, 25 Jul 2002, Hong Tian wrote:

    >I download patch of php-4.2.0-to-4.2.2.patch.gz from http://www.php.net and >try to update our PHP 4.2.0 to 4.2.2. But I can't find instructions how to >update PHP by using this patch of php-4.2.0-to-4.2.2.patch.gz. Could anyone >tell me how to patch it or where can I find this information to update PHP >by this patch?

    gunzip php-4.2.0-to-4.2.2.patch.gz cd /path/to/php_source cat /path/to/php-4.2.0-to-4.2.2.patch |patch

    you might also try 'man patch'

    -- 
    Greg Donald
    http://destiney.com
    

    attached mail follows:


    Thanks!

    -----Original Message----- From: Greg Donald [mailto:gregdestiney.com] Sent: Thursday, July 25, 2002 4:13 PM To: Hong Tian Cc: php-generallists.php.net Subject: Re: [PHP] patch of php

    On Thu, 25 Jul 2002, Hong Tian wrote:

    >I download patch of php-4.2.0-to-4.2.2.patch.gz from http://www.php.net and >try to update our PHP 4.2.0 to 4.2.2. But I can't find instructions how to >update PHP by using this patch of php-4.2.0-to-4.2.2.patch.gz. Could anyone >tell me how to patch it or where can I find this information to update PHP >by this patch?

    gunzip php-4.2.0-to-4.2.2.patch.gz cd /path/to/php_source cat /path/to/php-4.2.0-to-4.2.2.patch |patch

    you might also try 'man patch'

    -- 
    Greg Donald
    http://destiney.com
    

    attached mail follows:


    Hello,

    I was looking for a query_string wrapper for web crawlers I found pathtovars : http://www.phpclasses.org/browse.html/package/561.html

    English is not my native language. I didnt manage to use efficently this script ! Even with the sample !

    I don't know how to map url ? How to generate an url ? How to retrieve variables values in the current url ?

    I found this script with a very little doc.

    Is there someone that can have a look and try to explain me simply ?

    For eg : How to retieve : $var1 = value1 $var2 = value2 with that on that script http://www.domain.com/var1_value1/var2_value2/ ....

    Thanks.

    attached mail follows:


    >http://www.domain.com/var1_value1/var2_value2/ would look like this: http://www.domain.com/script.php?var1=value1&var2=value2 there would be a document name << script.php >> followed by the << ? >> then variable and value pairs << var1=value1 >> separate each variable/value pair with an ampersand << & >>

    Hope this helps

    Bret

    Find a contractor or find a contract at Tech-Temp.com

    ----- Original Message ----- From: "David D" <ddasi.fr> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 2:24 PM Subject: [PHP] I didnt understand the how work pathtovars, a php gpl script

    > Hello, > > I was looking for a query_string wrapper for web crawlers > I found pathtovars : > http://www.phpclasses.org/browse.html/package/561.html > > English is not my native language. > I didnt manage to use efficently this script ! > Even with the sample ! > > I don't know how to map url ? > How to generate an url ? > How to retrieve variables values in the current url ? > > I found this script with a very little doc. > > Is there someone that can have a look and try to explain me simply ? > > For eg : > How to retieve : > $var1 = value1 > $var2 = value2 > with that on that script > http://www.domain.com/var1_value1/var2_value2/ > .... > > Thanks. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

    attached mail follows:


    > would look like this: > http://www.domain.com/script.php?var1=value1&var2=value2 > there would be a document name << script.php >> > followed by the << ? >> > then variable and value pairs << var1=value1 >> > separate each variable/value pair with an ampersand << & >> > > Hope this helps > > Bret I know how get var are mapped in php script...

    But I would like to know how to use : http://www.phpclasses.org/browse.html/package/561.html ?

    with that : http://www.domain.com/var1_value1/var2_value2/ +pathtovars

    making in the script :

    $var1 = value1 $var2 = value2

    Thanks.

    attached mail follows:


    I make my own : What u think about : begin ================================================

    <? // Author : David Devidal ddasi.fr // Licence : GPL // // include one time this script at the beginnig of the script // file will do the mapping // // for the revers mapping think of using normurl2trans($url);

    /* print_r($HTTP_GET_VARS); print_r($HTTP_POST_VARS);

    echo "PHP_SELF $PHP_SELF <br>"; echo "REQUEST_URI $REQUEST_URI <br>"; echo "SCRIPT_NAME $SCRIPT_NAME <br>"; echo "PATH_INFO $PATH_INFO <br>"; echo "PATH_TRANSLATED $PATH_TRANSLATED <br>";

    // Array ( ) Array ( ) PHP_SELF /path2vars/index.php/var1,val1/var2,val2/ // REQUEST_URI /path2vars/index.php/var1,val1/var2,val2/ // SCRIPT_NAME /path2vars/index.php // PATH_INFO /var1,val1/var2,val2/ // PATH_TRANSLATED c:\\easyphp\\www\\var1,val1\\var2,val2\\

    exit();

    */ //phpinfo();

    // we will transform vars from 1 style to 2 style // 1) http://localhost/path2vars/index.php?&var1=val1&var2=val2 en // 2) http://localhost/path2vars/index.php/var1,val1/var2,val2/ // that will permit a better crawls with web crawlers

    // from type 1) to type 2) function normurl2trans($url) { // we cut the url in 2 part 1 to keep and the other to manipulate $urldecoup = split($GLOBALS[SCRIPT_NAME],$url); $urldecoup[1] = str_replace('?&','&',$urldecoup[1]); // for easily progs $urldecoup[1] = strtr($urldecoup[1], '&=', '/,'); // map particulars chars return $urldecoup[0].$GLOBALS[SCRIPT_NAME].$urldecoup[1].'/'; }

    // from type 2) to type 1) function trans2norm($url) { // we cut the url in 2 part 1 to keep and the other to manipulate $urldecoup = split($GLOBALS[SCRIPT_NAME],$url); $urldecoup[1] = strtr($urldecoup[1],'/,','&='); // map particulars chars $urldecoup[1] = $urldecoup[0].$GLOBALS[SCRIPT_NAME].'?'.$urldecoup[1].'/'; return str_replace('&/','',$urldecoup[1]); // for easily progs } // little test unit for fonctions //echo normurl2trans ("http://localhost/path2vars/index.php?&var1=val1&var2=val2"); //echo trans2norm("http://localhost/path2vars/index.php/var1,val1/var2,val2/");

    /************* // the vars parser : // we make it here not in a fucntions for globals vars context // works at each case no vars 1 2 ... **************/ $urltemp = str_replace($SCRIPT_NAME.'/','',$PHP_SELF); // get string to explode // gives var1,val1/var2,val2/ // we had to cut into with / $urldecoup = split('/',$urltemp); // gives Array ( [0] => var1,val1 [1] => var2,val2 [2] => ) $urltempsize = count($urldecoup)-1; // we dont treat the last elemnts that is empty for ($urltempi=0;$urltempi<$urltempsize;$urltempi++) { $nameval = split(',',$urldecoup[$urltempi]); // cut 2 elts var1,val1 ${$nameval[0]} = $nameval[1]; // affect $var1 with value val1 //$var1="val1"; } // end parse

    /* // little test unit echo "$var1<br>"; echo "$var2<br>"; */

    /** <html> here is a little query string parser to get work web crawlers url test :<br>

    <? require_once('query_string_parser.php'); $thelink = normurl2trans ("http://localhost/path2vars/index.php?&var1=val1&var2=val2");

    echo "<a href='$thelink'>lien ni1</a><br>";

    echo $var1.'<br>'; echo $var2.'<br>'; ? <html> **/ ?>

    =================================end cut

    Thanks

    attached mail follows:


    Downloads for the Windows binaries are broken.

    attached mail follows:


    Hello, I am stuck here. In the name of efficiency I want to lower the number of callls to the database. So I am trying to give the most stringent query possible. This is the problem: I have stored the surfers shopping cart, where each item is stored as a session variable.Now on the database I have ALL inventory items, but I want to only display the details of what the user has in his cart. eg. : I want something like this:

    $result = mysql_query("SELECT * from Inventory where ItemNumber is in $HTTP_SESSION_VARS"); // I need proper syntax to replace "is in"

    where Inventory has, ItemNumber (unique), Price, ItemName. So say the surfer has three items in the Session, then I stored the three unique ItemNumbers. Then with the above query I can get the rest of the information to represent to the user. I am looking down the avenues of a Set datastyp or maybe Enum, but I don't know if it will help.

    attached mail follows:


    You might be making it more difficult than it needs to me. You're not dealing with a huge number of queries here so why not just loop it? I would simply loop through the $_SESSION array and query the dbase for each item.

    foreach ($_SESSION as $key => $val) { $query = "SELECT * FROM inventory WHERE itemnumber = '$val'"; $result = mysql_query($query, $db); // .. blah blah blah... }

    -Kevin

    ----- Original Message ----- From: "Anup" <anup_patelrogers.com> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 12:51 PM Subject: [PHP] mySQL Queries using PHP's SESSION variables

    > Hello, I am stuck here. In the name of efficiency I want to lower the number > of callls to the database. So I am trying to give the most stringent query > possible. This is the problem: I have stored the surfers shopping cart, > where each item is stored as a session variable.Now on the database I have > ALL inventory items, but I want to only display the details of what the user > has in his cart. > eg. : I want something like this: > > $result = mysql_query("SELECT * from Inventory where ItemNumber is in > $HTTP_SESSION_VARS"); > // I need proper syntax to replace "is in" > > where Inventory has, ItemNumber (unique), Price, ItemName. > So say the surfer has three items in the Session, then I stored the three > unique ItemNumbers. > Then with the above query I can get the rest of the information to represent > to the user. > I am looking down the avenues of a Set datastyp or maybe Enum, but I don't > know if it will help. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    well, you could simply loop through the session vars and build the query as you go.

    $query = "SELECT * FROM Inventory WHERE";

    // I'm assuming you keep your item numbers in a "items" or something similar foreach ($HTTP_SESSION_VARS['items'] as $pid) $subquery .= " ItemNumber = '$pid' OR "; // get rid of last _OR_ $subquery = ereg_replace('[:space:]OR[:space:]$', '', $subquery); // put the query together $query = $query . $subquery;

    // add more crap to query if you want $query .= " and some_other_column='something_else'";

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Anup" <anup_patelrogers.com> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 1:51 PM Subject: [PHP] mySQL Queries using PHP's SESSION variables

    > Hello, I am stuck here. In the name of efficiency I want to lower the number > of callls to the database. So I am trying to give the most stringent query > possible. This is the problem: I have stored the surfers shopping cart, > where each item is stored as a session variable.Now on the database I have > ALL inventory items, but I want to only display the details of what the user > has in his cart. > eg. : I want something like this: > > $result = mysql_query("SELECT * from Inventory where ItemNumber is in > $HTTP_SESSION_VARS"); > // I need proper syntax to replace "is in" > > where Inventory has, ItemNumber (unique), Price, ItemName. > So say the surfer has three items in the Session, then I stored the three > unique ItemNumbers. > Then with the above query I can get the rest of the information to represent > to the user. > I am looking down the avenues of a Set datastyp or maybe Enum, but I don't > know if it will help. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    On Thu, Jul 25, 2002 at 02:51:13PM -0400, Anup wrote: > Hello, I am stuck here. In the name of efficiency I want to lower the number > of callls to the database. So I am trying to give the most stringent query > possible. This is the problem: I have stored the surfers shopping cart, > where each item is stored as a session variable.Now on the database I have > ALL inventory items, but I want to only display the details of what the user > has in his cart. > eg. : I want something like this: > > $result = mysql_query("SELECT * from Inventory where ItemNumber is in > $HTTP_SESSION_VARS");

    Other folks have made suggestions, but this is way simpler. Assuming the session vars and ItemNumber are numbers:

    $result = mysql_query('SELECT * from Inventory where ItemNumber IN (' . implode(',', $_SESSION) . ')');

    If it's strings:

    $result = mysql_query("SELECT * from Inventory where ItemNumber IN ('" . implode("','", $_SESSION) . "')");

    --Dan

    -- 
                   PHP classes that make web design easier
            SQL Solution  |   Layout Solution   |  Form Solution
        sqlsolution.info  | layoutsolution.info |  formsolution.info
     T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
     4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
    

    attached mail follows:


    I am trying to use GD Library on a windows 2000 installation of PHP. php_gd.dll is in the extensions folder and the line: ";extension=php_gd.dll" is in my php.ini file, but I recieve the error: "Fatal error: Call to undefined function: imagecreate()" when I try to use the imagecreate(100,100) function. Any ideas?

    Thanks!

    attached mail follows:


    I'm not a windoze user but if that line has a ";" at the beginning of it like you have it in your message then it is commented out! LOL. :-)

    Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "Ryan Moore" <webbalancestudios.com> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 1:44 PM Subject: [PHP] GD Library

    > I am trying to use GD Library on a windows 2000 installation of PHP. > php_gd.dll is in the extensions folder and the line: ";extension=php_gd.dll" > is in my php.ini file, but I recieve the error: "Fatal error: Call to > undefined function: imagecreate()" when I try to use the > imagecreate(100,100) function. Any ideas? > > Thanks! > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

    attached mail follows:


    [snip] I am trying to use GD Library on a windows 2000 installation of PHP. php_gd.dll is in the extensions folder and the line: ";extension=php_gd.dll" is in my php.ini file, but I recieve the error: "Fatal error: Call to undefined function: imagecreate()" when I try to use the imagecreate(100,100) function. Any ideas? [/snip]

    Remove the ";" in front of the extension listing in your .ini file and restart your web server.

    HTH!

    Jay

    attached mail follows:


    Not only the solution just posted, but I was using this before and needed to set the dll used to php_gd2.dll, I am pretty sure it got renamed in one of the more recent releases of PHP.

    Matt Babineau MCWD / CCFD ----------------------------------------- e: mattcriticalcode.com p: 603.943.4237 w: http://www.criticalcode.com PO BOX 601 Manchester, NH 03105

    -----Original Message----- From: Ryan Moore [mailto:webbalancestudios.com] Sent: Thursday, July 25, 2002 2:44 PM To: php-generallists.php.net Subject: [PHP] GD Library

    I am trying to use GD Library on a windows 2000 installation of PHP. php_gd.dll is in the extensions folder and the line: ";extension=php_gd.dll" is in my php.ini file, but I recieve the error: "Fatal error: Call to undefined function: imagecreate()" when I try to use the imagecreate(100,100) function. Any ideas?

    Thanks!

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

    attached mail follows:


    If you dowloaded the PHP 4.2.2 installer you don't have the php_gd.dll in your machine, you have to download the PHP 4.2.2 zip package from php.net and overwrite all your files in the php folder, this zip file contains all the dll's for windows including the php_gd.dll, then remove the ; in the Windows Extensions part of your php.ini corresponding to the gd library and check that the extension_dir in Paths and Directories has the same directory where the extensions are.

    At 01:44 PM 7/25/2002 -0500, you wrote: >I am trying to use GD Library on a windows 2000 installation of PHP. >php_gd.dll is in the extensions folder and the line: ";extension=php_gd.dll" >is in my php.ini file, but I recieve the error: "Fatal error: Call to >undefined function: imagecreate()" when I try to use the >imagecreate(100,100) function. Any ideas? > >Thanks! > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php

    Jadiel Flores ------------------------- http://www.abargon.com jfloresabargon.com (52-55) 52-29-80-34

    attached mail follows:


    Instead of : ;extension=php_gd.dll

    Try: extension=php_gd.dll

    Sign ; is a comment... so you must delete it ...

    --
    Lp,
    Mitja
    "Ryan Moore" <webbalancestudios.com> wrote in message
    news:20020725184729.80798.qmailpb1.pair.com...
    > I am trying to use GD Library on a windows 2000 installation of PHP.
    > php_gd.dll is in the extensions folder and the line:
    ";extension=php_gd.dll"
    > is in my php.ini file, but I recieve the error: "Fatal error:  Call to
    > undefined function:  imagecreate()" when I try to use the
    > imagecreate(100,100) function. Any ideas?
    >
    > Thanks!
    >
    >
    

    attached mail follows:


    Is it possible to run PHP that is embedded within a string? I have a file that is read into a string and returned to the browser, how can I run that PHP?

    i.e.

    <? function something() { // this is set earlier by other functions // $str = "<html><body>some html code<? $this->getForm("guest"); ?>some more html code</body></html>";

    return ($str); }

    echo $obj->something();

    --
    Joshua E Minnie/CIO
    joshacsurf.net
    Phone: 616.276.9690
    Fax: 616.342.8750
    Nextel: 616.862.2847
    

    "Don't work for recognition, but always do work worthy of recognition."

    attached mail follows:


    Sure. You want the eval() function. Can be a little tricky but you'll get it. http://www.php.net/manual/en/function.eval.php -Kevin

    ----- Original Message ----- From: "Joshua E Minnie" <joshacsurf.net> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 12:54 PM Subject: [PHP] Implement PHP within a string

    > Is it possible to run PHP that is embedded within a string? I have a file > that is read into a string and returned to the browser, how can I run that > PHP? > > i.e. > > <? > function something() { > // this is set earlier by other functions > // $str = "<html><body>some html code<? $this->getForm("guest"); ?>some more > html code</body></html>"; > > return ($str); > } > > echo $obj->something(); > > > -- > Joshua E Minnie/CIO > joshacsurf.net > Phone: 616.276.9690 > Fax: 616.342.8750 > Nextel: 616.862.2847 > > "Don't work for recognition, but always do work worthy of recognition." > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Hi there, I've got a quick question concerning PHP and mySQL. I've got a fresh server with recent versions of Red Hat Linux, mySQL, PHP and apache. My problem is that when I call mysql_pconnect, my PHP code hangs and doesn't proceed. I can't check mysql_error because it doesn't go beyond this point. I know that mysql is running and the PHP code prior to this statement works just fine. The mysql account is operating correctly from the prompt and I'm using all of the default values for PHP and mysql config. Has anybody had this problem before and can somebody please offer me some suggestions? Thank you!!!

    - Scott

    attached mail follows:


    If I select all from my db how can I print the individual results? For example, say i want to print record number 16 from the firstname column into a table. How can i accomplish this? I have all of my db access coded and have it selecting all from the db, but i want to print individual records into my table. Can I set the records to variables and use something like <?php echo {whatever would go here} ?> I am really lost here please help!

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

    attached mail follows:


    Well you could do something like this:

    while ($row = mysql_fetch_array) { echo "<tr><td>$row[data1]</td></tr>" }

    This will print out a table row for every record.. Now if you just want to print specific records then you might as well do that in the select statement to your database and then use the above...

    Cheers!

    Rick

    "The glory of friendship is not the outstretched hand, nor the kindly smile, nor the joy of companionship; it is the spiritual inspiration that comes to one when he discovers that someone else believes in him and is willing to trust him with his friendship." - Ralph Waldo Emerson

    > From: "Tyler Durdin" <linuxgeek23hotmail.com> > Date: Thu, 25 Jul 2002 19:01:34 +0000 > To: php-generallists.php.net > Subject: [PHP] printing results from mysql fetch array > > If I select all from my db how can I print the individual results? For > example, say i want to print record number 16 from the firstname column into > a table. How can i accomplish this? I have all of my db access coded and > have it selecting all from the db, but i want to print individual records > into my table. Can I set the records to variables and use something like > <?php echo {whatever would go here} ?> I am really lost here please help! > > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Well yah.. I mean you can move the array pointer by simply looping through the array 16 times. But why not simply take care of this in your SELECT statement?

    "SELECT .. blah blah blah.. ORDER BY firstname DESC LIMIT 16, 1"

    Returns one row starting with the 16th row ordered by the firstname in descending order.

    -Kevin

    ----- Original Message ----- From: "Tyler Durdin" <linuxgeek23hotmail.com> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 1:01 PM Subject: [PHP] printing results from mysql fetch array

    > If I select all from my db how can I print the individual results? For > example, say i want to print record number 16 from the firstname column into > a table. How can i accomplish this? I have all of my db access coded and > have it selecting all from the db, but i want to print individual records > into my table. Can I set the records to variables and use something like > <?php echo {whatever would go here} ?> I am really lost here please help! > > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Hello,

    On 07/25/2002 05:27 AM, Justin French wrote: >>You'll need to catch bounces as they come in. To make life easier, assign >>your own unique Message-IDs and remember them, so you can easily >>invalidate addresses. > > > Erm, I'm on a shared server, so I don't *think* it's that easy unfortunately > -- I can't get a message to bounce to the From: or Reply-To: headers I set. > My guess is it goes to an address set in php.ini, or somewhere else, and is > global to the entire server (doesn't help me). > > Unless I can set it was .htaccess or ini_set().

    You do not need to set the return-path/envelop sender address in php.ini . There are ways to work around that. It depends on the platform that you use, but in general you can use this class for that purpose.

    http://www.phpclasses.org/mimemessage

    -- 
    

    Regards, Manuel Lemos

    attached mail follows:


    Hello All,

    I am trying to use the "" symbol to suppress errors returned by a mysql_query call. This doesn't seem to be working as I get an new page with the error in it in my browser. Any help with this would be greatly appreciated.

    Here is a snippet of the code I am using

    $query = "select user_id from users where username='$username'"; $query_db = mysql_query($query, $db_connection); $row = mysql_fetch_array($query_db); if($row) { $message[] = "That username is already taken. Please select another."; } else {

    Thanks, Preston

    attached mail follows:


    What is the error you get?

    ---John Holmes...

    ----- Original Message ----- From: "Preston Wade" <Preston_Wadehilton.com> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 3:20 PM Subject: [PHP] suppressing errors

    > Hello All, > > I am trying to use the "" symbol to suppress errors returned by a > mysql_query call. This doesn't seem to be working as I get an new page with > the error in it in my browser. Any help with this would be greatly > appreciated. > > Here is a snippet of the code I am using > > $query = "select user_id from users where username='$username'"; > $query_db = mysql_query($query, $db_connection); > $row = mysql_fetch_array($query_db); > if($row) { > $message[] = "That username is already taken. Please select > another."; > } else { > > Thanks, > Preston > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    The error is one from mysql stating that I am trying to add a duplicate entry. I would rather handle this in my code hence the following lines in my code.

    if($row) { $message[] = "That username is already taken. Please select another."; } else {

    Thanks for the response.

    Thanks, Preston

    > -----Original Message----- > From: "1LT John W. Holmes" <holmes072000charter.net>INTERNETHHC > Sent: Thursday, July 25, 2002 2:53 PM > To: Preston Wade; php-generallists.php.net > Subject: Re: [PHP] suppressing errors > > What is the error you get? > > ---John Holmes... > > ----- Original Message ----- > From: "Preston Wade" <Preston_Wadehilton.com> > To: <php-generallists.php.net> > Sent: Thursday, July 25, 2002 3:20 PM > Subject: [PHP] suppressing errors > > > > Hello All, > > > > I am trying to use the "" symbol to suppress errors returned by a > > mysql_query call. This doesn't seem to be working as I get an new page > with > > the error in it in my browser. Any help with this would be greatly > > appreciated. > > > > Here is a snippet of the code I am using > > > > $query = "select user_id from users where username='$username'"; > > $query_db = mysql_query($query, $db_connection); > > $row = mysql_fetch_array($query_db); > > if($row) { > > $message[] = "That username is already taken. Please select > > another."; > > } else { > > > > Thanks, > > Preston > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > >

    attached mail follows:


    > > > $query = "select user_id from users where username='$username'"; > > > $query_db = mysql_query($query, $db_connection); > > > $row = mysql_fetch_array($query_db); > > > if($row) { > > > $message[] = "That username is already taken. Please select > > > another."; > > > } else { > The error is one from mysql stating that I am trying to add a duplicate > entry. I would rather handle this in my code hence the following lines in > my code.

    That error message wouldn't come from any of the lines above. You're not INSERTing anything, just SELECTing. Are you sure there isn't another mysql_query() somewhere else without an in front of it??

    ---John Holmes...

    ----- Original Message ----- From: "Preston Wade" <Preston_Wadehilton.com> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 4:58 PM Subject: RE: [PHP] suppressing errors

    > The error is one from mysql stating that I am trying to add a duplicate > entry. I would rather handle this in my code hence the following lines in > my code. > > if($row) { > $message[] = "That username is already taken. Please select > another."; > } else { > > Thanks for the response. > > Thanks, > Preston > > > > -----Original Message----- > > From: "1LT John W. Holmes" <holmes072000charter.net>INTERNETHHC > > Sent: Thursday, July 25, 2002 2:53 PM > > To: Preston Wade; php-generallists.php.net > > Subject: Re: [PHP] suppressing errors > > > > What is the error you get? > > > > ---John Holmes... > > > > ----- Original Message ----- > > From: "Preston Wade" <Preston_Wadehilton.com> > > To: <php-generallists.php.net> > > Sent: Thursday, July 25, 2002 3:20 PM > > Subject: [PHP] suppressing errors > > > > > > > Hello All, > > > > > > I am trying to use the "" symbol to suppress errors returned by a > > > mysql_query call. This doesn't seem to be working as I get an new page > > with > > > the error in it in my browser. Any help with this would be greatly > > > appreciated. > > > > > > Here is a snippet of the code I am using > > > > > > $query = "select user_id from users where username='$username'"; > > > $query_db = mysql_query($query, $db_connection); > > > $row = mysql_fetch_array($query_db); > > > if($row) { > > > $message[] = "That username is already taken. Please select > > > another."; > > > } else { > > > > > > Thanks, > > > Preston > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Hello folks,

    Apologies for the cross-post, but I wanted to announce the publication of a new HOWTO on compiling ODBC support into PHP and Apache with the iODBC Driver Manager:

    It's available at the www.iodbc.org site in the left hand column.

    You may view the document directly at: http://www.iodbc.org/odbc-php-apache2.html

    Please provide feedback and comments!

    Best regards, Andrew Hill Director of Technology Evangelism - OpenLink Software ---------------------------------------------------------------- What is Virtuoso? http://www.openlinksw.com/virtuoso/whatis.htm

    attached mail follows:


    Hi I am still battling alot with understanding how sessions work (don't work in my case).

    Firstly: I am trying to find a reliable method for coding with sessions that will work on basically any server and any browser; meaning no cookies and passing the SID to all url's manually. My app has the following ( amongst others) index.php = login page with form and 2 fields (username / password), session_start() On the action page, I session_start() again, and then session_register("username","password") and I don't need to give them values as the form fields are called that and PHP generates them for me (register_globals = on). This works great, on ALL subsequent pages in the app, I can simply call $username and $password, and it works.

    BUT, my app has alot of iterations, and now I'm battling to understand how to change these session variables "on the fly" in a sensible manner; in particular when it comes to forms that "generate" their own variables on submit.

    It seems like my problem comes in that I can only set a session variable once it "exists" , ie, on the action page, and then also, that the app goes "backwards" allowing you to change your options, yet, when yuou do, the variables does not contain the new variables.

    The fact that the app also doesn't have a specific "end" means I also don't know where to place the session_destroy()...

    I have made 4 small pages to illustrate :

    index.php -------------------------------------------------------------------------------------------------------------------- <?php session_start(); ?> <form action="page2.php?<?=SID?>" method="POST" enctype="multipart/form-data"> <table> <tr> <td>Username </td> <td><input type="text" name="username"> </td> </tr> <tr> <td>Password </td> <td><input type="text" name="password"> </td> </tr> <tr> <td> </td> <td><input type="submit" name="submit"></td> </tr> </table> </form> -------------------------------------------------------------------------------------------------------------------- page2.php -------------------------------------------------------------------------------------------------------------------- <?php session_start(); session_register("username","password"); ?> This is username: <?=$username?><br> This is password: <?=$password?><br> <form action="page3.php?<?=SID?>" method="POST" enctype="multipart/form-data"> <table> <tr> <td>First Variable</td> <td><input type="text" name="first"> </td> </tr> <tr> <td>Second Variable</td> <td><input type="text" name="second"> </td> </tr> <tr> <td></td> <td><input type="submit" name="submit"></td> </tr> </table> </form> -------------------------------------------------------------------------------------------------------------------- page3.php -------------------------------------------------------------------------------------------------------------------- <?php session_start(); session_register("first","second"); ?> This is username: <?=$username?><br> This is password: <?=$password?><br> This is first variable: <?=$first?><br> This is second variable: <?=$second?><br> <a href="page2.php?<?=SID?>">To Page 2</a><br> <a href="page4.php?<?=SID?>">To Page 4</a><br> -------------------------------------------------------------------------------------------------------------------- page4.php -------------------------------------------------------------------------------------------------------------------- <?php session_start(); ?> This is username: <?=$username?><br> This is password: <?=$password?><br> This is first variable: <?=$first?><br> This is second variable: <?=$second?><br> <a href="page3.php?<?=SID?>">To Page 3</a> --------------------------------------------------------------------------------------------------------------------

    Also, not sure if it is browser related, but on mine, I sometimes get 2x SESSIONID=xxxxxxxxxxxx added to the end of the URL, even though I clearly put it in once only...

    Am I missing the point here? Plz help to make things clearer to me... The only way I can get above scanario to work is to add the variable manually to all the url's as I've been coding all along.

    attached mail follows:


    1) session_start() is not really required on any other pages beside the index.php because session_register take care of that for you.

    2) It should work when you try session_register() on the index.php, use a makeup name, like session_register("user") then assign the data to it, like $user[username] = "whatever" & $user['password'] = "passwhatever". This is a simplier way and it does work.

    "Petre" <internetvsa.co.za> wrote in message news:3D404FA2.8050301vsa.co.za... > Hi > I am still battling alot with understanding how sessions work (don't > work in my case). > > Firstly: I am trying to find a reliable method for coding with sessions > that will work on basically any server and any browser; meaning no > cookies and passing the SID to all url's manually. > My app has the following ( amongst others) > index.php = login page with form and 2 fields (username / password), > session_start() > On the action page, I session_start() again, and then > session_register("username","password") and I don't need to give them > values as the form fields are called that and PHP generates them for me > (register_globals = on). > This works great, on ALL subsequent pages in the app, I can simply call > $username and $password, and it works. > > BUT, my app has alot of iterations, and now I'm battling to understand > how to change these session variables "on the fly" in a sensible manner; > in particular when it comes to forms that "generate" their own variables > on submit. > > It seems like my problem comes in that I can only set a session variable > once it "exists" , ie, on the action page, and then also, that the app > goes "backwards" allowing you to change your options, yet, when yuou do, > the variables does not contain the new variables. > > The fact that the app also doesn't have a specific "end" means I also > don't know where to place the session_destroy()... > > I have made 4 small pages to illustrate : > > index.php > -------------------------------------------------------------------------- ------------------------------------------ > <?php > session_start(); > ?> > <form action="page2.php?<?=SID?>" method="POST" > enctype="multipart/form-data"> > <table> > <tr> > <td>Username </td> > <td><input type="text" name="username"> </td> > </tr> > <tr> > <td>Password </td> > <td><input type="text" name="password"> </td> > </tr> > <tr> > <td> </td> > <td><input type="submit" name="submit"></td> > </tr> > </table> > </form> > -------------------------------------------------------------------------- ------------------------------------------ > page2.php > -------------------------------------------------------------------------- ------------------------------------------ > <?php > session_start(); > session_register("username","password"); > ?> > This is username: <?=$username?><br> > This is password: <?=$password?><br> > <form action="page3.php?<?=SID?>" method="POST" > enctype="multipart/form-data"> > <table> > <tr> > <td>First Variable</td> > <td><input type="text" name="first"> </td> > </tr> > <tr> > <td>Second Variable</td> > <td><input type="text" name="second"> </td> > </tr> > <tr> > <td></td> > <td><input type="submit" name="submit"></td> > </tr> > </table> > </form> > -------------------------------------------------------------------------- ------------------------------------------ > page3.php > -------------------------------------------------------------------------- ------------------------------------------ > <?php > session_start(); > session_register("first","second"); > ?> > This is username: <?=$username?><br> > This is password: <?=$password?><br> > This is first variable: <?=$first?><br> > This is second variable: <?=$second?><br> > <a href="page2.php?<?=SID?>">To Page 2</a><br> > <a href="page4.php?<?=SID?>">To Page 4</a><br> > -------------------------------------------------------------------------- ------------------------------------------ > page4.php > -------------------------------------------------------------------------- ------------------------------------------ > <?php > session_start(); > ?> > This is username: <?=$username?><br> > This is password: <?=$password?><br> > This is first variable: <?=$first?><br> > This is second variable: <?=$second?><br> > <a href="page3.php?<?=SID?>">To Page 3</a> > -------------------------------------------------------------------------- ------------------------------------------ > > Also, not sure if it is browser related, but on mine, I sometimes get 2x > SESSIONID=xxxxxxxxxxxx added to the end of the URL, even though I > clearly put it in once only... > > Am I missing the point here? > Plz help to make things clearer to me... > The only way I can get above scanario to work is to add the variable > manually to all the url's as I've been coding all along. >

    attached mail follows:


    On 25 Jul 2002 at 12:12, Matt Babineau wrote:

    > When first speaking with a client, would you charge an initial > constation fee for lets say conference calls? How would you invoice > stuff like this? on a monthly basis? Or every two weeks?

    Hi,

    I apologize for adding some noise but I really don't know of a good list for these things. I keep planning on putting my smartarchitectures.com site to use for this as so many problems are non langauge specific but we always ask in our favorite language list.

    Anyhow, Here is how I have done and prefer to do a project (but TMTOWDI of course)

    Initial meeting is free. This has usually be filtered by sales or some other means. But I always think talking ideas is worth time. I'm a bit cautious about giving out any really good ideas in this meeting. Try to see if client is serious. From this meeting I then work up an estimate of the followin ... oh heck here is a proposal I did (my first "proposal" since I become a free-lancer):

    http://www.coremodules.com/customer/memphisworks_proposal.php

    The client did not accept me :(. They went with someone else. I did mention to the client, are you ready, that they use HR XML standards so seekers and suppliers of jobs can talk to the site via XML .. that means that you the job seeker would not have to repeate the same old thing (if you have your resume in a database like your dear friend) but could just upload the XML file of your resume and thus populate all the fields and that the supplier could upload job offers via XML and not pay some drone to create typos in forms. Even though the client was in the HR business she had never heard of XML. Oh well.

    I go into more detail about what the proposal above refers to here:

    http://www.coremodules.com/process/doc_process.php

    Yes, some of that comes from some Proejct Management books I've read. I believe a system, even if flawed, is better than no system at all. NOTE, yes, I know some links are broken from that page.

    BTW, at the ad agency I worked at, we billed on a regular schedule.

    Peter

    attached mail follows:


    Hi,

    I have a problem with conditional image generation. If I generate an image without any conditional statments, then everything works fine. But if i introduce conditional statment, then no image is generated in either case of the condition.

    Has anyone dealt with this dilema before?

    Thanks in advance, alex

    P.S.

    I am generating a hit-counter image.

    The set-up is very basic: if admin looks at the page, then image should be generated and displayed

    if anyone else loads the page, no image should be generated.

    my code goes smth like this:

    <?php

    if (! fromOffice() ) { $image = ImageCreate(1,1); $navyblue = ImageColorAllocate($image, 0, 0, 0); ImageFilledRectangle($image, 0, 0, 1, 1, $navyblue); } else { $image = ImageCreate(125, 150); //... }

    header("Content-Type: image/png"); header("Content-Disposition: inline; filename=counter.php"); ImagePng($image);

    //have to destroy the image, otherwise will starve web-server's memory ImageDestroy($image);

    ?>

    attached mail follows:


    This will allow you to compile PHP 4.2.x as a shared object into Apache 2.0.39.

    Credits to somebody on Google Groups (I can't recall, but I needed an answer to this too a couple weeks back)...

    1. Open up the file php_functions.c in /sapi/apache2filter/ 2. Change MODULE_MAGIC_AT_LEAST to AP_MODULE_MAGIC_AT_LEAST (Note the addition of "AP_") 3. Save the php_functions.c file and try running configure again

    Keep in mind this is experimental and thus should not be used on production web sites (even though we've been using Apache 2.0.39+PHP 4.2.1/4.2.2 for a few weeks without issues on two of our servers).

    --
    Aaron Gould
    agouldpartscanada.com
    Web Developer
    

    attached mail follows:


    On Thu, Jul 25, 2002 at 12:36:27PM +0200, Nicklas af Ekenstam wrote: > > In order to read the headers into an array of header key/value fields > i would like a reg exp to remove all new lines/line feeds before a > line starting with one or more white spaces or tabs.

    In ereg_replace() you can use [[:space:]] as the pattern and replace it with ' '. That will grab all whitespace characters and replace them with a one space.

    To do that with preg_replace() use \s.

    --Dan

    -- 
                   PHP classes that make web design easier
            SQL Solution  |   Layout Solution   |  Form Solution
        sqlsolution.info  | layoutsolution.info |  formsolution.info
     T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
     4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
    

    attached mail follows:


    On Thu, 25 Jul 2002, Nicklas af Ekenstam wrote: > I'm trying to do some parsing of mail headers and since not all > headers follow the pattern: > > X-Header-A: A string > X-Header-B: Another string that is longer > X-Header-C: And this string is very very long compared > > But may very well look like this: > > X-Header-A: A string > X-Header-B: Another string that is > longer > X-Header-C: And this string is very very long > compared

    I imagine you want something like (untested):

    $str = preg_replace('/\n[ \t]+/s', ' ', $str);

    miguel

    attached mail follows:


    > On Thu, Jul 25, 2002 at 12:36:27PM +0200, Nicklas af Ekenstam wrote: > > > > In order to read the headers into an array of header key/value fields > > i would like a reg exp to remove all new lines/line feeds before a > > line starting with one or more white spaces or tabs.

    Pardon my prior post. I only saw "how to remove new lines/line feeds" and not the second part of the sentence "before a line starting with one or more white spaces or tabs."

    preg_replace('/[\r\n]+[ \t]+/', ' ', $header);

    --Dan

    -- 
                   PHP classes that make web design easier
            SQL Solution  |   Layout Solution   |  Form Solution
        sqlsolution.info  | layoutsolution.info |  formsolution.info
     T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
     4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
    

    attached mail follows:


    Hello,

    I have this example code: function doprint($a){foreach($a as $value)echo $value;} doprint(array('1','test','hello','and'));

    Question, is the array in memory after the function call? So, should it be better to use this:

    function doprint($a){foreach($a as $value)echo $value;} doprint($temp=array('1','test','hello','and')); unset($temp);

    Thanks,

    Bas

    attached mail follows:


    On Thu, Jul 25, 2002 at 10:26:03PM +0200, Bas Jobsen wrote: > Hello, > > I have this example code: > function doprint($a){foreach($a as $value)echo $value;} > doprint(array('1','test','hello','and')); > > Question, is the array in memory after the function call? > So, should it be better to use this: > > function doprint($a){foreach($a as $value)echo $value;} > doprint($temp=array('1','test','hello','and')); > unset($temp);

    Depends on the scope you're talking about. The first way doesn't set the array into memory outside the function, but it goes into memory inside the function as $a. The second way puts it into memory twice, first as $temp and second as $a.

    Now, I'm not certain of what happens to your memory allocation inside the function. I don't believe PHP automatically cleans up memory under such circumstances. If I'm correct and you want to keep memory down, you could do an unset() INSIDE the function.

    --Dan

    -- 
                   PHP classes that make web design easier
            SQL Solution  |   Layout Solution   |  Form Solution
        sqlsolution.info  | layoutsolution.info |  formsolution.info
     T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
     4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
    

    attached mail follows:


    Hi!

    There are a couple of websites I had to move from one machine to this window machine and it introduced two new problems. There are two different version of PHP, however IIS can work with two different version of PHP without a problem. The 2nd problem is to have two different php.ini file from two different PHP version to work together.

    Have anyone experience this problem? What would be the best solution to the problem? Recommended Solution to the problem? Suggestion? Upgrading a couple of websites that use the old version of PHP is not an option right now. That would take way too long and there's not enough time for that right now.

    Thanks, FletchSOD

    attached mail follows:


    Are you using the CGI executable or the server plug in thingy?

    If you're using one of each, the server module looks for C:\windows\php.ini and the executeable looks for php.ini in the same directory as the executeable.

    If you have two CGI versions, you could rename one and rename its php.ini accordingly i.e. php4.exe and php4.ini but I don't know if this would work.

    There is something in the help (CHM version anyway) about running PHP3 and PHP4 together but PHP3 didn't have the server extensions did it?

    "Scott Fletcher" <scottabcoa.com> wrote in message news:20020725203610.15605.qmailpb1.pair.com... > Hi! > > There are a couple of websites I had to move from one machine to this window > machine and it introduced two new problems. There are two different version > of PHP, however IIS can work with two different version of PHP without a > problem. The 2nd problem is to have two different php.ini file from two > different PHP version to work together. > > Have anyone experience this problem? What would be the best solution to the > problem? Recommended Solution to the problem? Suggestion? Upgrading a > couple of websites that use the old version of PHP is not an option right > now. That would take way too long and there's not enough time for that > right now. > > Thanks, > FletchSOD > >

    attached mail follows:


    If you use cgi, no problem, just put the php.ini into the php directory (instead of the windows directory). This works.

    If you use isapi, i think it's not possible, but i'm not shure.

    Christoph

    Scott Fletcher wrote: > Hi! > > There are a couple of websites I had to move from one machine to this > window machine and it introduced two new problems. There are two > different version of PHP, however IIS can work with two different > version of PHP without a problem. The 2nd problem is to have two > different php.ini file from two different PHP version to work > together. > > Have anyone experience this problem? What would be the best solution > to the problem? Recommended Solution to the problem? Suggestion? > Upgrading a couple of websites that use the old version of PHP is not > an option right now. That would take way too long and there's not > enough time for that right now. > > Thanks, > FletchSOD

    attached mail follows:


    Christoph Grottolo wrote: > If you use cgi, no problem, just put the php.ini into the php > directory (instead of the windows directory). This works.

    sorry, forgot to write: put the different versions of php into different directories (i.e. c:\php\php421 and c:\php\php430)

    Christoph

    >> There are a couple of websites I had to move from one machine to this >> window machine and it introduced two new problems. There are two >> different version of PHP, however IIS can work with two different >> version of PHP without a problem. The 2nd problem is to have two >> different php.ini file from two different PHP version to work >> together. >> >> Have anyone experience this problem? What would be the best solution >> to the problem? Recommended Solution to the problem? Suggestion? >> Upgrading a couple of websites that use the old version of PHP is not >> an option right now. That would take way too long and there's not >> enough time for that right now. >> >> Thanks, >> FletchSOD

    attached mail follows:


    Yea, I recently put them into 2 different directories. I'm doing the research on cgi vs. isapi right now. Anyway, I create a test site and it showed up okay, got the error message about the security-alert, something about the cgi that can not be accessed directly. My impression is that they are working. Just need to modify the php.ini or something.

    Thanks! "Christoph Grottolo" <cggordimer.net> wrote in message news:20020725210010.48146.qmailpb1.pair.com... > Christoph Grottolo wrote: > > If you use cgi, no problem, just put the php.ini into the php > > directory (instead of the windows directory). This works. > > > sorry, forgot to write: > put the different versions of php into different directories (i.e. > c:\php\php421 and c:\php\php430) > > Christoph > > >> There are a couple of websites I had to move from one machine to this > >> window machine and it introduced two new problems. There are two > >> different version of PHP, however IIS can work with two different > >> version of PHP without a problem. The 2nd problem is to have two > >> different php.ini file from two different PHP version to work > >> together. > >> > >> Have anyone experience this problem? What would be the best solution > >> to the problem? Recommended Solution to the problem? Suggestion? > >> Upgrading a couple of websites that use the old version of PHP is not > >> an option right now. That would take way too long and there's not > >> enough time for that right now. > >> > >> Thanks, > >> FletchSOD >

    attached mail follows:


    Yep, it's CGI! It's compiled in binary with the force-cgi-redirect enabled. Need to turn this off in PHP since I'm using IIS, not apache. It's not working very well but at least, running websites with different php versions work well.

    THanks

    "Scott Fletcher" <scottabcoa.com> wrote in message news:20020725211118.58318.qmailpb1.pair.com... > Yea, I recently put them into 2 different directories. I'm doing the > research on cgi vs. isapi right now. Anyway, I create a test site and it > showed up okay, got the error message about the security-alert, something > about the cgi that can not be accessed directly. My impression is that they > are working. Just need to modify the php.ini or something. > > Thanks! > "Christoph Grottolo" <cggordimer.net> wrote in message > news:20020725210010.48146.qmailpb1.pair.com... > > Christoph Grottolo wrote: > > > If you use cgi, no problem, just put the php.ini into the php > > > directory (instead of the windows directory). This works. > > > > > > sorry, forgot to write: > > put the different versions of php into different directories (i.e. > > c:\php\php421 and c:\php\php430) > > > > Christoph > > > > >> There are a couple of websites I had to move from one machine to this > > >> window machine and it introduced two new problems. There are two > > >> different version of PHP, however IIS can work with two different > > >> version of PHP without a problem. The 2nd problem is to have two > > >> different php.ini file from two different PHP version to work > > >> together. > > >> > > >> Have anyone experience this problem? What would be the best solution > > >> to the problem? Recommended Solution to the problem? Suggestion? > > >> Upgrading a couple of websites that use the old version of PHP is not > > >> an option right now. That would take way too long and there's not > > >> enough time for that right now. > > >> > > >> Thanks, > > >> FletchSOD > > > >

    attached mail follows:


    I am getting a parse error on line 14, I am trying to make sure session vars are being set before rendering the page. This is lines 12,13,14 & 15. Any help is appreciated. Jas

    if ((!$u_name) || (!$p_word)){ header("Location: index.php"); session_destroy(); exit; } /* Check for missing session vars */ elseif ((!isset($HTTP_SESSION_VARS['clk']) || (!isset($HTTP_SESSION_VARS['holy_cow']) || (!isset($HTTP_SESSION_VARS['ipaddy']) || (!isset($HTTP_SESSION_VARS['a'])) { /* Begin logging of client info to database table since session vars are not present */ require '/path/to/connection/class/db.php';

    attached mail follows:


    I had experienced similar problem like that in the past. Part of it had to do with the header() function. Your script checked out fine, just like mine did. Try remarking the line of code where hte header is and see if you don't have hte parse error, if this is the case then it's the header(). "Jas" <jlgerfenhotmail.com> wrote in message news:20020725204017.20873.qmailpb1.pair.com... > I am getting a parse error on line 14, I am trying to make sure session vars > are being set before rendering the page. This is lines 12,13,14 & 15. Any > help is appreciated. > Jas > > if ((!$u_name) || (!$p_word)){ > header("Location: index.php"); > session_destroy(); > exit; } > /* Check for missing session vars */ > elseif ((!isset($HTTP_SESSION_VARS['clk']) || > (!isset($HTTP_SESSION_VARS['holy_cow']) || > (!isset($HTTP_SESSION_VARS['ipaddy']) || (!isset($HTTP_SESSION_VARS['a'])) { > /* Begin logging of client info to database table since session vars are > not present */ > require '/path/to/connection/class/db.php'; > >

    attached mail follows:


    Hi:

    On Thu, Jul 25, 2002 at 02:40:28PM -0600, Jas wrote: > I am getting a parse error on line 14, I am trying to make sure session vars > are being set before rendering the page. This is lines 12,13,14 & 15.

    The way you posted it here, it's hard to tell which line is which. Layout your script the same way it will look in your email, then run it. More importantly, we need to see the error message. There are TONS of different parse errors that can happen. Plus, I bet if you read the message, and THINK about what it says, it'll give you a clue what to look for.

    > if ((!$u_name) || (!$p_word)){

    Use empty($var) rather than (!$var) to avoid warnings where the var isn't even set.

    > header("Location: index.php");

    Location needs a full URI: http://www.foo.com/index.php.

    But, I don't think any of those will produce parse errors.

    --Dan

    -- 
                   PHP classes that make web design easier
            SQL Solution  |   Layout Solution   |  Form Solution
        sqlsolution.info  | layoutsolution.info |  formsolution.info
     T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
     4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
    

    attached mail follows:


    Ok, I noticed a couple things.

    One: There's no } ending your elseif statement.

    Two (and the big one): Why all the opening brackets before your isset() functions? I'm not sure if you're trying to do some nested logic in there, but if so it will be much more readable if you use nested if statements instead of a single huge statement. If you quickly count you'll see that you've got 8 opening brackets and only 5 closing ones. That's where your problem lies.

    At 02:40 PM 7/25/2002 -0600, you wrote: >I am getting a parse error on line 14, I am trying to make sure session vars >are being set before rendering the page. This is lines 12,13,14 & 15. Any >help is appreciated. >Jas > >if ((!$u_name) || (!$p_word)){ > header("Location: index.php"); > session_destroy(); > exit; } >/* Check for missing session vars */ >elseif ((!isset($HTTP_SESSION_VARS['clk']) || >(!isset($HTTP_SESSION_VARS['holy_cow']) || >(!isset($HTTP_SESSION_VARS['ipaddy']) || (!isset($HTTP_SESSION_VARS['a'])) { > /* Begin logging of client info to database table since session vars are >not present */ > require '/path/to/connection/class/db.php'; > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    > elseif ((!isset($HTTP_SESSION_VARS['clk']) || > (!isset($HTTP_SESSION_VARS['holy_cow']) || > (!isset($HTTP_SESSION_VARS['ipaddy']) || (!isset($HTTP_SESSION_VARS['a']))

    Your parenthesis don't match up, if I can count correctly today.

    ---John Holmes...

    attached mail follows:


    Maybe the wrong forum, but im giving it a try.

    Im used to for instance 2 columns in each table indicating when it was created and when it was last updated:

    Changed_date Registered_date

    In mysql it seems it is only possible to define a column as a timestamp, and this will trigger both on insert and delete. Is it possible to define changed_date to trigger only on update in mysql or do i have do give the correct timestamp "manually" from php?

    Thanx

    -R

    attached mail follows:


    I believe MySQL will only automatically update one TIMESTAMP field per record, according to their online docs. It will update if you don't specify a value when inserting a new record. You can also use the DATETIME field type which stores data as YYYY-MM-DD HH:MM:SS. This is what I use because it's easier to read by humans. Date and time are inserted into all DATETIME fields in a record automatically when set to allow NULL. You can then easily convert this to a Unix timestamp easily using the MySQL UNIX_TIMESTAMP() function when doing a query. PHP also has similar date/time conversion commands.

    I'm not a MySQL expert, so, the above my not be totally accurate, it's based on my own experience.

    Monty

    > From: ragnarchello.no (Ragnar) > Organization: na > Reply-To: "Ragnar" <ragnarchello.no> > Newsgroups: php.general > Date: Fri, 26 Jul 2002 00:19:02 +0200 > To: php-generallists.php.net > Subject: timestamp triggered only on update? > > Maybe the wrong forum, but im giving it a try. > > Im used to for instance 2 columns in each table indicating when it was > created and when it was last updated: > > Changed_date > Registered_date > > In mysql it seems it is only possible to define a column as a timestamp, and > this will trigger both on insert and delete. Is it possible to define > changed_date to trigger only on update in mysql or do i have do give the > correct timestamp "manually" from php? > > Thanx > > -R > >

    attached mail follows:


    hehe.. ofcourse i ment:

    ...this will trigger both on insert and update.

    "Ragnar" <ragnarchello.no> wrote in message news:20020725221905.6304.qmailpb1.pair.com... > Maybe the wrong forum, but im giving it a try. > > Im used to for instance 2 columns in each table indicating when it was > created and when it was last updated: > > Changed_date > Registered_date > > In mysql it seems it is only possible to define a column as a timestamp, and > this will trigger both on insert and delete. Is it possible to define > changed_date to trigger only on update in mysql or do i have do give the > correct timestamp "manually" from php? > > Thanx > > -R > >

    attached mail follows:


    Hi,

    Has anyone used PHP alongside MSDE?

    I've recently taken a brief look at freetds which allows a UNIX/LINUX box to talk to an MSSQL/SYBASE server, but I cannot find any metion of MSDE.

    Can anyone shed any light on this or report any successes?

    Cheers

    Lee

    attached mail follows:


    Hi

    I have this regular expression:

    (((http|https|ftp|gopher)|mailto):(//)?[^ <>"\t]*|www\.[-a-z0-9.]+)[^ .,;\t<">\):]

    Which is supposed to match hyperlinks. I would like to use this from php to grab all hyperlinks in a text file and return them in an array.

    I've messed around with the function preg_match_all() but I just can't seem to get it to work. Any suggestions would be very appreciated.

    Thanks, Nicklas

    attached mail follows:


    It comes with the zip file of that distribution - and it works fine (except for TTF which I can't for the life of me get to work on Win32)

    frak! "Peter" <phpvfsa.com.au> wrote in message news:DPEPKCNEFOKBCNNANCIPCELHCGAA.phpvfsa.com.au... > Jadiel, > > i do that the file ur after and tried sending it to u but ur server rejected > it. > > > -----Original Message----- > > From: Jadiel Flores [mailto:jfloresabargon.com] > > Sent: Wednesday, 24 July 2002 9:03 AM > > To: php-generallists.php.net > > Subject: [PHP] GD Library for Windows > > > > > > I'm trying to develop a thumbnail creation module for a website > > but I can't > > get gd library to work in a Win2000 Advanced Server, PHP 4.2.1, IIS 5. > > > > Does anybody has the php_gd.dll for this version?? > > > > Thanks. > > > > > > Jadiel Flores > > ------------------------- > > http://www.abargon.com > > jfloresabargon.com > > (52-55) 52-29-80-34 > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > >

    attached mail follows:


    Hi

    > for the first case - using "\n", try : > ereg_replace('\n+', '\n\n\n', $str)

    This is right, apart from the fact that \n characters will no be parsed with single quotes. Try this...

    <?php ereg_replace("\n+", "\n\n\n", $str); ?>

    Sorry, just a minor thing.

    Mike

    -- 
    MGS2 Online
    http://www.mgs2online.f2s.com
    

    attached mail follows:


    Hi

    I am building (or attemting to build) an msn messenger class. I am having problems reading from the socket.

    I open a connection with fsockopen(), i then write commands to the socket with fputs(). I am reading wth fgets().

    It is all fine if I am reading one line returned by the server, the script runs quickly. However is i wish to read multiple lines the script basically stops. I am working with code like this to read multiple lines...

    <?php function read() { $fp =& $this->fp; $this->response = ''; while($line = fgets($fp, 1024)) { $this->response .= $line; } return $this->response; } ?>

    I think it may be geting into an infinite loop. With nntp protocol you can test for a fullstop and then stop reading, does anyone know if there is somthing like this in msn messenger protocol? has anyone else had this problem.

    I rewrote the class using the socket functions such as socket_create(), socket_connect() and socket_read() but had the same problems. Is it a problem with my code or is it somthing to do with the way the server is working? help me!

    Thanks, Mike

    -- 
    MGS2 Online
    http://www.mgs2online.f2s.com
    

    attached mail follows:


    > In article <DPEPKCNEFOKBCNNANCIPEEOMCGAA.phpvfsa.com.au>, > phpvfsa.com.au > says... > > ok unix.h problem solved but now it's saying can't locate > .libs/libZend.a > > .... any ideas? > > > > > > Furrfu - don't tar all *nix with the same brush :-) Presumably, for some > reason, that file hasn't been created? Have a look in the libs directory > under your tarball extraction directory; but perhaps the few lines out of > make output prior to the error might be useful?

    the last few lines of the make are as follows:

    . . . . . . zend_sprintf.lo `test -f zend_sprintf.c || echo './'`zend_sprintf.c /bin/sh ../libtool --silent --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../mainzend_ini.lo `test -f zend_ini.c || echo './'`zend_ini.c /bin/sh ../libtool --silent --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../mainzend_qsort.lo `test -f zend_qsort.c || echo './'`zend_qsort.c /bin/sh ../libtool --silent --mode=link c -g -O2 -prefer-non-pic -static -o.lo zend_ini_scanner.lo zend_alloc.lo zend_compile.lo zend_constants.lo zend_dyn.lo zend_opcode.lo zend_operators.lo zend_ptr_stack.lo zend_stack.lo zend_variabndent.lo zend_builtin_functions.lo zend_sprintf.lo zend_ini.lo zend_qsort.lo -ld ../libtool: ar: not found make[1]: *** [libZend.la] Error 1 make[1]: Leaving directory `/usr/local/php-4.2.2/Zend' make: *** [all-recursive] Error 1

    Cheers Peter

    attached mail follows:


    You need to look at mysql_list_dbs(), this returns an array of all available databases on a connection.

    -- 
    MGS2 Online
    http://www.mgs2online.f2s.com
    

    attached mail follows:


    Hello,

    Using php v 4.2.2 with pdflib support, on apache v. 1.3, and redhat linux 7.2.

    I for some reason can not get a pdf_setfont, pdf_set_text_pos, pdf_[anything], to work inside a function. What is going on. All the pdf extensions work find as long as I dont try to use them inside a function that I create.

    ie:

    PDF_set_text_pos($p, 80, 670); PDF_show($p, "Requirements:");

    works just fine outside of a function but if I put the same thing inside a function like so

    function help() { PDF_set_text_pos($p, 80, 670); PDF_show($p, "Test:"); }

    I will not get Test text to display inside the PDF document, If I change this, so that I add a position to it, like so:

    function help($position_y) { PDF_set_text_pos($p, 80, $position_y); PDF_show($p, "Test:"); }

    I get this error:

    Warning: pdf_set_text_pos(): supplied argument is not a valid pdf object resource in /var/www/html/form/test.php on line 16

    What am I doing wrong?

    Jeff

    attached mail follows:


    Hello,

    I'm trying to do a simple form for a local organization and I'm running into problems with the server. I am unable to get any of the variables in the html code to post across to the php file. So, I'm figuring register_globals is off. So I change my code to use HTTP_POST_VARS and HTTP_GET_VARS and get this error:

    Parse error: parse error in /usr/local/etc/httpd/vhosts/htdocs/scripts/join.php on line 3

    Here is a snippet of the first few lines of my code:

    <?php

    $Agree_to_Terms_of_Membership = HTTP_POST_VARS["Agree_to_Terms_of_Membership"]; $realname = HTTP_POST_VARS["realname"]; $Company_Name = HTTP_POST_VARS["Company_Name"]; $Description = HTTP_POST_VARS["Description"]; $Street_Address = HTTP_POST_VARS["Street_Address"];

    I did a phpinfo and their ISP is running PHP Version 4.0B2 and I can see track_vars is on.

    What is going on here? Any suggestions as to what I'm doing wrong?

    Thanks.

    Rob.

    attached mail follows:


    You missed the $ before HTTP_POST_VARS. its $HTTP_POST_VARS (its a variable, not a constant. only constants dont have a $ before them)

    Jason Reid jasonachost.ca

    --
    AC Host Canada
    www.achost.ca
    

    ----- Original Message ----- From: "bob" <subscriptionsnhinsights.com> To: <php-generallists.php.net> Sent: Thursday, July 25, 2002 6:29 PM Subject: [PHP] Problem with HTTP_POST_VARS

    > Hello, > > I'm trying to do a simple form for a local organization and I'm running into > problems with the server. I am unable to get any of the variables in the > html code to post across to the php file. So, I'm figuring register_globals > is off. So I change my code to use HTTP_POST_VARS and HTTP_GET_VARS and get > this error: > > Parse error: parse error in > /usr/local/etc/httpd/vhosts/htdocs/scripts/join.php on line 3 > > Here is a snippet of the first few lines of my code: > > > <?php > > $Agree_to_Terms_of_Membership = > HTTP_POST_VARS["Agree_to_Terms_of_Membership"]; > $realname = HTTP_POST_VARS["realname"]; > $Company_Name = HTTP_POST_VARS["Company_Name"]; > $Description = HTTP_POST_VARS["Description"]; > $Street_Address = HTTP_POST_VARS["Street_Address"]; > > I did a phpinfo and their ISP is running PHP Version 4.0B2 and I can see > track_vars is on. > > What is going on here? Any suggestions as to what I'm doing wrong? > > Thanks. > > Rob. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

    attached mail follows:


    Duh! Thanks guys.... that's what I was missing.

    -----Original Message----- From: Bas Jobsen [mailto:basstartpunt.cc] Sent: Thursday, July 25, 2002 8:33 PM To: subscriptionsnhinsights.com Subject: Re: [PHP] Problem with HTTP_POST_VARS

    put a $ before HTTP_POST_VARS be: $Agree_to_Terms_of_Membership=$HTTP_POST_VARS["Agree_to_Terms_of_Membership" ]; Op vrijdag 26 juli 2002 02:29, schreef u: > Hello, > > I'm trying to do a simple form for a local organization and I'm running > into problems with the server. I am unable to get any of the variables in > the html code to post across to the php file. So, I'm figuring > register_globals is off. So I change my code to use HTTP_POST_VARS and > HTTP_GET_VARS and get this error: > > Parse error: parse error in > /usr/local/etc/httpd/vhosts/htdocs/scripts/join.php on line 3 > > Here is a snippet of the first few lines of my code: > > > <?php > > $Agree_to_Terms_of_Membership = > HTTP_POST_VARS["Agree_to_Terms_of_Membership"]; > $realname = HTTP_POST_VARS["realname"]; > $Company_Name = HTTP_POST_VARS["Company_Name"]; > $Description = HTTP_POST_VARS["Description"]; > $Street_Address = HTTP_POST_VARS["Street_Address"]; > > I did a phpinfo and their ISP is running PHP Version 4.0B2 and I can see > track_vars is on. > > What is going on here? Any suggestions as to what I'm doing wrong? > > Thanks. > > Rob.

    attached mail follows:


    Hi.

    I've tried this:

    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-control: private"); header("Cache-control: no-cache"); header("Cache-control: no-store"); header("Cache-control: must-revalidate"); header("Cache-control: proxy-revalidate"); header("Cache-control: max-age=0"); header("Pragma: no-cache");

    session_cache_limiter('private, must-revalidate'); ( and session_cache_limiter('nocache') )

    But it doesn't work - winroute cache everything. Does anyone know any solution?

    -- 
    Best regards,
     Evgeny                          mailto:geckabaik.ru
    

    attached mail follows:


    I'd like to be able to run a mysql_query() once while executing more than one mysql command... for example:

    while($row = mysql_fetch_array($result)) { $query_cmd = "INSERT INTO tblTest1 (number) VALUES (1);"; $query_cmd .= "INSERT INTO tblTest2 (id, val) VALUES(LAST_INSERT_ID, 'some data');";

    mysql_query($query_cmd); }

    When I run code similar to that listed above, I get a mysql error "error at line 1." -- however, if I run the INSERTS separately -- no error.

    Is there a way I can run multiple commands within one string?

    Thanks Jason

    attached mail follows:


    Can't do it. One SQL command per MySQL_query().

    ---John Holmes...

    > -----Original Message----- > From: Jason Caldwell [mailto:jasonthinkingman.org] > Sent: Thursday, July 25, 2002 8:51 PM > To: php-generallists.php.net > Subject: [PHP] PHP, MySQL & multiple commands?? > > I'd like to be able to run a mysql_query() once while executing more than > one mysql command... for example: > > while($row = mysql_fetch_array($result)) > { > $query_cmd = "INSERT INTO tblTest1 (number) VALUES (1);"; > $query_cmd .= "INSERT INTO tblTest2 (id, val) VALUES(LAST_INSERT_ID, > 'some data');"; > > mysql_query($query_cmd); > } > > When I run code similar to that listed above, I get a mysql error "error > at > line 1." -- however, if I run the INSERTS separately -- no error. > > Is there a way I can run multiple commands within one string? > > Thanks > Jason > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

    attached mail follows:


    This list works well when people ask questions which aren't readily available in the manual. People will get pretty frustrated with you pretty quick, and the help will dry out unless you start showing a little initiative before posting.

    With a smart-arse little remark like the one you just gave, I'm pretty sure I can't be bothered helping you any more :o)

    (cute smiley face included, just for you)

    Justin

    on 25/07/02 7:17 PM, Philip J. Newman (newmanpjphilipnz.com) wrote:

    > why read the manual when i can get someone else to give me the answer (o; > > ----- Original Message ----- > From: "Justin French" <justinindent.com.au> > To: "Philip J. Newman" <newmanpjphilipnz.com>; <php-generallists.php.net> > Sent: Thursday, July 25, 2002 8:30 PM > Subject: Re: [PHP] Newman Asks, Do i have to use session_name('sid') > every... > > >> on 25/07/02 5:43 PM, Philip J. Newman (newmanpjphilipnz.com) wrote: >> >>> session_name('sid'); >>> session_start(); >>> >>> Do i have to use session_name('sid'); every time i use session_start(); > or >>> can session_name be used once? >> >> *sigh* >> >> How about testing it on two pages? >> >> Or better still, LOOK IN THE MANUAL!!!! >> >> php.net/session_name CLEARLY states: >> >> " >> The session name references the session id in cookies and URLs. It should >> contain only alphanumeric characters; it should be short and descriptive >> (i.e. for users with enabled cookie warnings). The session name is reset > to >> the default value stored in session.name at request startup time. Thus, > you >> need to call session_name() for every request (and before session_start() > or >> session_register() are called). >> " >> >> Justin French >> >> >> > > >

    attached mail follows:


    You need php_sockets.dll, and also to enable it in php.ini if you cannot find this i could upload it for u to d/l

    also the function socket() i think is no longer in use. You need the family of functions with the prefix "socket_".

    Mike

    -- 
    MGS2 Online
    http://www.mgs2online.f2s.com