OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Subject: php3 Digest 8 Apr 2000 04:58:50 -0000 Issue 1594
From: php3-digest-helplists.php.net
Date: Fri Apr 07 2000 - 23:58:50 CDT


php3 Digest 8 Apr 2000 04:58:50 -0000 Issue 1594

Topics (messages 84964 through 85037):

I need a little PDFavor :)
        84964 by: "Mark Roedel" <roedelmletu.edu>

GD in Win32
        84965 by: Hansen <azuralorong.co.id>

array in a database
        84966 by: "Andrew Sheh" <asheadmetechnologies.com>
        84971 by: Rouvas Stathis <rouvasdi.uoa.gr>
        84976 by: Doug Semig <dougslistc3net.net>

compiling problems..
        84967 by: Chad Day <chadbeachassociates.com>

PostgreSQL functions: hiding errors from browser ...
        84968 by: Doug Semig <dougslistc3net.net>

Select distinct on multiple columns
        84969 by: "Brian T. Allen" <brianpurenetfx.com>
        84989 by: "Roger Smith" <rogerjadebox.com>

echo db results
        84970 by: "Ryan" <phpelghund.com>
        84974 by: "Vamsi Nath" <vnathbuytrek.com>

Upload Two Files at the Sametimes
        84972 by: Mark Lo <marklokynetvigator.com>
        85026 by: "phplist" <phplistnyist.net>

Linux/Apache/PHP and HP-UX/ADABAS D
        84973 by: "Valdemir Augusto Castilho - BRA" <valdemirnovamerica.com.br>

Mail List Archiever
        84975 by: Ed Trefzger <etrefzg1rochester.rr.com>
        85008 by: Chad Cunningham <ccunningmath.ohio-state.edu>

Lookup ZIP+4 codes here...
        84977 by: Derek Sivers <listhitmedia.com>
        84987 by: Ryan Gaul <rgaultravel-italy.com>
        84999 by: mocha_php <mocha_phpyahoo.com>

MySQL connect woes continue
        84978 by: "burk" <burkpobox.com>
        84982 by: "J. Horner" <jhorner2jnetworks.com>
        84991 by: Wimble <tkstcorp.net>
        84994 by: "James Conner" <connerjpassageway.com>

imap.so
        84979 by: Ashwin Kutty <Ashwin.KuttyDal.Ca>

[PHP4BETA] JSP vs. PHP - Two vs. Three Teir
        84980 by: Michael Stearne <mstearneentermix.com>

PHP IDE
        84981 by: Michael Stearne <mstearneentermix.com>

Getting the last ID inserted from an specified table... help
        84983 by: "Manuel Lemos" <mlemosacm.org>
        84984 by: Cynic <cynicmail.cz>
        84985 by: "Boget, Chris" <chriswild.net>
        84986 by: "Boget, Chris" <chriswild.net>
        84996 by: "Martin Edelius" <martin.edeliusspirex.se>

HTTP POST syntax
        84988 by: <pete.tamisinknowledgestorm.com>

pasword forgot (need to encode and decode)
        84990 by: webmastersmurf.eu.org (Jeroen Olthof)
        85006 by: Ron Chmara <ronopus1.com>

PHP and links
        84992 by: "mayakovski" <mayakovskihotmail.com>

php3.0.15: Constants and classes
        84993 by: Tina Ruth-Gunnarsson <truthmultifin.com>
        84997 by: "Vamsi Nath" <vnathbuytrek.com>

fsockopen
        84995 by: "WL" <willlukrative.com>

[Fwd: [PHP3] MySQL connect woes continue]
        84998 by: Wimble <tkstcorp.net>
        85004 by: "Michael P. Korpics" <korpicsexpertchoice.com>

php3 and (x)emacs
        85000 by: Gianmarco Giovannelli <gmarcogiovannelli.it>

Refresh db query
        85001 by: Joris Verboomen <joris.verboomenglo.be>

DSO woes
        85002 by: "darcy w. christ" <darcyelegant.com>
        85003 by: Rasmus Lerdorf <rasmusphp.net>

Upload Progress
        85005 by: Boaz Yahav <berbernetvision.net.il>
        85007 by: Zeev Suraski <zeevzend.com>
        85011 by: Zak Greant <zakfreeimages.com>
        85012 by: Steve Edberg <sbedbergucdavis.edu>
        85019 by: mocha_php <mocha_phpyahoo.com>

need help
        85009 by: "Anupama Bagalur" <anupama_kumarhotmail.com>

mysql_connect fails in PHP3 cgi run from unix command line
        85010 by: Herman-HollySoft <hermanhollysoft.com>
        85014 by: "Brandt Everett" <everettbentonrea.com>
        85015 by: "Michael P. Korpics" <korpicsexpertchoice.com>

Form Generator
        85013 by: Hector Lucero <hqlpacbell.net>

Set up problem
        85016 by: "lelo" <lelodr.com>

Someone kick start me please...
        85017 by: Urs van Binsbergen <the_big_ubluewin.ch>

Date Formating Error - 12/30/1969
        85018 by: php3developersdesk.com

ASCII to ANSI? Why does PHP do this?
        85020 by: Darin Lang <darinflashcom.net>

Win98/PHP3/mySQL: connection timeout problem
        85021 by: Steff Osborne <sosbornestanleemedia.com>

callling multidemensional arrays
        85022 by: Bill Zeller <billzelleryahoo.com>
        85025 by: "Brad Schuetz" <bradcimmeria.com>

popen command
        85023 by: "Mohd Ikhwan \(Mahen\)" <ikhwantas.com.my>

File manager in your browser (Web Explorer RC 1.0)
        85024 by: "Sune Alexandersen" <sunedrs.no>

SUM of array
        85027 by: kevinoceania.net
        85034 by: "Hans H. Anderson" <mehansanderson.com>

Building Search Engines
        85028 by: "Hans H. Anderson" <mehansanderson.com>

MySQL & FTP on Win32
        85029 by: Chris Cameron <chrisupnix.org>

ASP to PHP converter
        85030 by: Matievaol.com
        85031 by: idban secandri <idbansatunet.com>

Array passing
        85032 by: "Minh Nguyen Van" <minhnvextramedia.com>
        85037 by: "Hans H. Anderson" <mehansanderson.com>

query question
        85033 by: "Rossi Designs" <webmasterrossidesigns.net>
        85036 by: "Hans H. Anderson" <mehansanderson.com>

Where Is IT?
        85035 by: Michael Stearne <mstearneentermix.com>

Administrivia:

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

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

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

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

attached mail follows:


> -----Original Message-----
> From: alex [mailto:alexquad.com.ar]
> Sent: Thursday, April 06, 2000 9:47 PM
> To: php3
> Subject: [PHP3] I need a little PDFavor :)
>
>
> if you have pdflib compiled at php would you try <?
> pdf_show_boxed() ?> and tell me if you get "Call to
> unsupported or undefined function pdf_show_boxed()"
> please?
>
> I have pdflib 2.1 on php3.0.15, I can use pdf functions..
> but not that one. it is supposed to work as described at
> http://www.php.net/manual/function.pdf-show-boxed.php

Looks, from a quick cruise through the PHP source, like you're probably out
of luck on two counts:

I see that function listed in the header files for PHP4RC1, but not for
PHP3.0.16.

Also, the PHP4 header file looks like it only includes that function if your
pdflib version is 2.20 or greater.

---
Mark Roedel             |  "Blessed is he who has learned to laugh
Systems Programmer      |   at himself, for he shall never cease
LeTourneau University   |   to be entertained."
Longview, Texas, USA    |                           -- John Powell

attached mail follows:


I try PHP3 3.0.15 for win32. In php.ini file module for gd I already activated. When I use function phpinfo() in output html I saw the GD. But, when I try to use function from module GD I get Error with message that function not define. Why this error would come? Is GD did not support in win32? Or, I'm not complete install PHP3 for win32? Please anyone help me!

Thank's

Hansen

attached mail follows:


Interesting answers from this thread. Does this mean forget about normalization? Can somebody tell me when it is best to do this?

Newbie here, that have gone some lengths to normalize (rules 1-3) my database and ended up with more tables than I wanted.

Andre Sheh

>-----Original Message----- >From: Zak Greant [mailto:zakfreeimages.com] >Sent: Friday, April 07, 2000 9:54 AM >To: Geoffrey Makstutis; php3lists.php.net >Subject: Re: [PHP3] array in a database > > >At 05:42 AM 4/7/00 +0100, Geoffrey Makstutis wrote: >>Hi, >> >>Is it possible to hold an array within a database cell? >> >>I can't seem to do this with mysql. >> >>What I'm currently trying is this, >> >>$value1="string"; >>$value2="string"; >>$value3="string"; >> >>$stuff = array($value1, $value2, $value3); >> >>insert into $table table_cell VALUES ($stuff); >> >>The table_cell is VARCHAR type. >> >>Any help would be appreciated. > >Unfortunately, you cannot directly store an array inside a >database. However, you can use the serialize function to >convert the array >( or any other variable ) into a form that can be stored. > >To store the array, you would do something like this: >$storable_version = serialize ($stuff); >mysql_query ( "INSERT INTO table (field_name) VALUES

>'$storable_version' >)" ); > >To retrieve the array you would need to do something like this: >$result = mysql_query ( "SELECT field_name FROM table" ); >$stored_version = mysql_result ( $result, 0, 0 ); >$stuff = unserialize ($stored_version); > >For more information, check out the entries for serialize and >unserialize >in the manual. > > >HTH, > >Zak Greant > > >-- >PHP 3 Mailing List <http://www.php.net/> >To unsubscribe, send an empty message to php3-unsubscribelists.php.net >To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net >To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-adminlists.php.net

attached mail follows:


I don't know what Db you are using, but if you can't get around this problem consider using Oracle. Version 8 supports both nested tables (a column of a one table is actually a table in itself) and arrays as a column. For more info : <URL:http://aspasia.mm.di.uoa.gr/inet/orasupport/html804/index.htm> or your favourite place of Oracle manuals. -Stathis. ps.:I think that now Oracle is free for downloading, through technet.oracle.com.

Andrew Sheh wrote: > > Interesting answers from this thread. Does this mean forget about > normalization? Can somebody tell me when it is best to do this? > > Newbie here, that have gone some lengths to normalize (rules 1-3) my > database and ended up with more tables than I wanted. > > Andre Sheh > > >-----Original Message----- > >From: Zak Greant [mailto:zakfreeimages.com] > >Sent: Friday, April 07, 2000 9:54 AM > >To: Geoffrey Makstutis; php3lists.php.net > >Subject: Re: [PHP3] array in a database > > > > > >At 05:42 AM 4/7/00 +0100, Geoffrey Makstutis wrote: > >>Hi, > >> > >>Is it possible to hold an array within a database cell? > >> > >>I can't seem to do this with mysql. > >> > >>What I'm currently trying is this, > >> > >>$value1="string"; > >>$value2="string"; > >>$value3="string"; > >> > >>$stuff = array($value1, $value2, $value3); > >> > >>insert into $table table_cell VALUES ($stuff); > >> > >>The table_cell is VARCHAR type. > >> > >>Any help would be appreciated. > > > >Unfortunately, you cannot directly store an array inside a > >database. However, you can use the serialize function to > >convert the array > >( or any other variable ) into a form that can be stored. > > > >To store the array, you would do something like this: > >$storable_version = serialize ($stuff); > >mysql_query ( "INSERT INTO table (field_name) VALUES > > >'$storable_version' > >)" ); > > > >To retrieve the array you would need to do something like this: > >$result = mysql_query ( "SELECT field_name FROM table" ); > >$stored_version = mysql_result ( $result, 0, 0 ); > >$stuff = unserialize ($stored_version); > > > >For more information, check out the entries for serialize and > >unserialize > >in the manual. > > > > > >HTH, > > > >Zak Greant > > > > > >-- > >PHP 3 Mailing List <http://www.php.net/> > >To unsubscribe, send an empty message to php3-unsubscribelists.php.net > >To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > >To search the mailing list archive, go to: > http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net

-- 
+-----------------------------+
|Rouvas Stathis               |
|University of Athens         |
|Department of Informatics    |
|http://www.di.uoa.gr/~rouvas |
|rouvasdi.uoa.gr             |
+-----------------------------+

attached mail follows:


And don't forget that if there's a possibility of the strings you're trying to put into the database could contain quotation marks or apostrophes, you'll want to addslashes:

----------------------BEGIN MODIFIED QUOTE----------------------- To store the array, you would do something like this: $storable_version = addslashes(serialize ($stuff)); mysql_query ( "INSERT INTO table (field_name) VALUES ( '$storable_version' )" );

To retrieve the array you would need to do something like this: $result = mysql_query ( "SELECT field_name FROM table" ); $stored_version = mysql_result ( $result, 0, 0 ); $stuff = unserialize (stripslashes($stored_version)); ---------------------- END MODIFIED QUOTE-----------------------

Doug

Zak Greant was heard at 10:54 AM 4/7/00 -0600 to say: >At 05:42 AM 4/7/00 +0100, Geoffrey Makstutis wrote: >>Hi, >> >>Is it possible to hold an array within a database cell? >> >>I can't seem to do this with mysql. >> >>What I'm currently trying is this, >> >>$value1="string"; >>$value2="string"; >>$value3="string"; >> >>$stuff = array($value1, $value2, $value3); >> >>insert into $table table_cell VALUES ($stuff); >> >>The table_cell is VARCHAR type. >> >>Any help would be appreciated. > >Unfortunately, you cannot directly store an array inside a >database. However, you can use the serialize function to convert the array >( or any other variable ) into a form that can be stored. > >To store the array, you would do something like this: >$storable_version = serialize ($stuff); >mysql_query ( "INSERT INTO table (field_name) VALUES ( '$storable_version' >)" ); > >To retrieve the array you would need to do something like this: >$result = mysql_query ( "SELECT field_name FROM table" ); >$stored_version = mysql_result ( $result, 0, 0 ); >$stuff = unserialize ($stored_version); > >For more information, check out the entries for serialize and unserialize >in the manual. > > >HTH, > >Zak Greant

attached mail follows:


Still continuing in my quest to get apache and mod_perl and mod_php to all play nicely.

Right now I have compiled apache vanilla, all modules DSO, mod_perl DSO. trying to get mod_php in there DSO.

./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs

(runs fine)

make

Making all in Zend Making all in ext Making all in db Making all in mysql Making all in libmysql Making all in pcre Making all in pcrelib Making all in posix Making all in session Making all in standard Making all in xml Making all in expat Making all in xmltok Making all in xmlparse Making all in sapi Making all in apache Making all in regex Making all in . CONFIG_FILES= CONFIG_HEADERS= ./config.status creating internal_functions.c internal_functions.c is unchanged +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+ /bin/sh ./libtool --silent --mode=compile gcc -DHAVE_CONFIG_H -I. -I/usr/local/php-4.0RC1/. -I. -I./Zend -I/usr/local/php-4.0RC1 -I/usr/local/apache/include -I/usr/local/php-4.0RC1/ext/mysql/libmysql -I/usr/local/php-4.0RC1/ext/xml/expat/xmltok -I/usr/local/php-4.0RC1/ext/xml/expat/xmlparse -DXML_BYTE_ORDER=12 -D_REENTRANT -D_THREAD_SAFE -g -O2 -Wall -c internal_functions.c /bin/sh ./libtool --silent --mode=link gcc -g -O2 -Wall -o libphp4.la -rpath /usr/local/php-4.0RC1/libs -avoid-version main.lo internal_functions.lo snprintf.lo php_sprintf.lo configuration-parser.lo configuration-scanner.lo safe_mode.lo fopen-wrappers.lo php_realpath.lo alloca.lo php_ini.lo SAPI.lo rfc1867.lo dlist.lo php_content_types.lo strlcpy.lo strlcat.lo mergesort.lo reentrancy.lo php_variables.lo php_ticks.lo Zend/libZend.la sapi/apache/libsapi.la regex/libregex.la ext/db/libdb.la ext/mysql/libmysql.la ext/pcre/libpcre.la ext/posix/libposix.la ext/session/libsession.la ext/standard/libstandard.la ext/xml/libxml.la -lpam -lm -lcrypt main.lo: file not recognized: File truncated *** Error code 1

Stop. *** Error code 1

Stop.

any ideas? I'm a bit of a newbie, I'm not sure how to fix that.. searched around on mailing lists but I couldn't find anything on main.lo..

Chad

attached mail follows:


The traditional way to do this kind of thing is to do a SELECT on the key first...if you get a row back, don't do the INSERT (instead, you could check to see if anything was modified and do an UPDATE, or provide your customized error page about trying to add a record with a duplicate key, and/or do whatever kind of processing you need to do such as log the attempt to a file).

But as has been mentioned, you could use the .

Tradeoff:

o doing it the traditional way is more work for the DBMS because you will be running 2 SQL statements (SELECT and INSERT) for every valid record

o it can be more network traffic if your DBMS is hosted on a machine different than your app. Fortunately, selecting out a record by a unique key will return at most one record (and at least an empty result set) so even if the DBMS is on a separate machine from your app, the network traffic is minimal.

o BUT you can do anything you want to if an existing record is returned by the SELECT...customized error message/screen, log the error, see if it should be an UPDATE instead of an INSERT, etc.

Doug

The Hermit Hacker was heard at 09:54 AM 4/7/00 -0300 to say: > >I have a page that inserts values into a UNIQUE field, but if I do a >reload, of course, it tries to insert it a second time, resulting in: > >Warning: PostgresSQL query failed: ERROR: Cannot insert a duplicate key > into a unique index in ... > >popping up in my browser. > >Is there someway to surpress this? I'd like to trap the result and act on >it, but don't want the end-user to see it ... > >Thanks ... > >Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy >Systems Administrator hub.org >primary: scrappyhub.org secondary: scrappy{freebsd|postgresql}.org >

attached mail follows:


Hi everyone,

I am using PHP4 RC1and MySQL and have a table with 5 columns:

CAT_1 CAT_2 CAT_3 CAT_4 CAT_5

They are categories, selected from drop down menus, used to select the categories a product fits into. For instance, a book on gardening would fit into both the gardening section, so CAT_1 may be 'Gardening' and also in the books section, so CAT_2 = 'Books'.

I want to select all of the categories (from all 5 columns) that have products in them, so that only categories with products show up.

If it were all in one column I could do:

SELECT DISTINCT CATEGORY FROM PRODUCST GROUP BY CATEGORY;

How can I do this with multiple columns?

Several options come to mind: 1) There is a way to do it in the query. 2) Select distinct on all columns, read them into an array and eliminate duplicates. 3) Select distinct on all colums, and pipe it to sort | uniq on the command line.

Any thoughts?

Thanks all! Brian brianpurenetfx.com

attached mail follows:


What you probably should have done (sorry) is used a link table instead of multiple columns for the categories. The link table would have a schema like:

Category_ID Product_ID

The Category_ID is a key into a Categories table and the Product_ID is a key into the Product table. The link table relates products and categories. This way you're not limited to 5 categories per product and the query you want is pretty simple:

Select Distinct Category_ID from ProductCategory;

Which gets the list of category IDs which contain products. Since you're probably looping in your code for each category anyway, you could then look up the category's name (and other information such as an icon image or whatever) from the Category table.

-- Roger

----- Original Message ----- From: Brian T. Allen <brianpurenetfx.com> To: <php3lists.php.net> Sent: Friday, April 07, 2000 2:10 PM Subject: [PHP3] Select distinct on multiple columns

Hi everyone,

I am using PHP4 RC1and MySQL and have a table with 5 columns:

CAT_1 CAT_2 CAT_3 CAT_4 CAT_5

They are categories, selected from drop down menus, used to select the categories a product fits into. For instance, a book on gardening would fit into both the gardening section, so CAT_1 may be 'Gardening' and also in the books section, so CAT_2 = 'Books'.

I want to select all of the categories (from all 5 columns) that have products in them, so that only categories with products show up.

If it were all in one column I could do:

SELECT DISTINCT CATEGORY FROM PRODUCST GROUP BY CATEGORY;

How can I do this with multiple columns?

Several options come to mind: 1) There is a way to do it in the query. 2) Select distinct on all columns, read them into an array and eliminate duplicates. 3) Select distinct on all colums, and pipe it to sort | uniq on the command line.

Any thoughts?

Thanks all! Brian brianpurenetfx.com

attached mail follows:


I have a silly question,

I'm doing a simple MySQL query like so:

$result = mysql_db_query("db","select id, dog from mytable order by dog desc limit 5"); while($row = mysql_fetch_object($result)) {

Now what I want to do is have it echo each of the 5 results on it's own line, with every other line being bold text. I can't figure out how to do get it to make every other line bold text unless I wanted to do 5 separate queries. I've also experimented with mysql_fetch_array, but still no luck.

Thanks in advance Ryan mailto:ryanelghund.com

attached mail follows:


Try this:

$cnt = 1; while($row = mysql_fetch_object($result)) { print ($cnt % 2) ? "<b>Your Result</b>" : "Your Result"; ++$cnt; }

Hope this helps!

--Vamsi

----- Original Message ----- From: "Ryan" <phpelghund.com> To: <php3lists.php.net> Sent: Friday, April 07, 2000 2:09 PM Subject: [PHP3] echo db results

> I have a silly question, > > I'm doing a simple MySQL query like so: > > $result = mysql_db_query("db","select id, dog from mytable order by dog desc > limit 5"); > while($row = mysql_fetch_object($result)) { > > Now what I want to do is have it echo each of the 5 results on it's own > line, with every other line being bold text. I can't figure out how to do > get it to make every other line bold text unless I wanted to do 5 separate > queries. I've also experimented with mysql_fetch_array, but still no luck. > > Thanks in advance > Ryan > mailto:ryanelghund.com > > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net

attached mail follows:


Hi,

I would like to know how to upload two files at the sametimes, and then put the two in different directories.

Thank You

Mark Lo

attached mail follows:


Uploading multiple files{from the manual!} It is possible to upload multiple files simultaneously and have the information organized automatically in arrays for you. To do so, you need to use the same array submission syntax in the HTML form as you do with multiple selects and checkboxes: Note: Support for multiple file uploads was added in version 3.0.10. Example 15-2. Uploading multiple forms <form action="file-upload.html" method="post" enctype="multipart/form-data"> Send these files:<br> <input name="userfile[]" type="file"><br> <input name="userfile[]" type="file"><br> <input type="submit" value="Send files"> </form> When the above form is submitted, the arrays $userfile, $userfile_name, and $userfile_size will be formed in the global scope (as well as in $HTTP_POST_VARS). Each of these will be a numerically indexed array of the appropriate values for the submitted files. For instance, assume that the filenames /home/test/review.html and /home/test/xwp.out are submitted. In this case, $userfile_name[0] would contain the value review.html, and $userfile_name[1] would contain the value xwp.out. Similarly, $userfile_size[0] would contain review.html's filesize, and so forth. -wang shui

attached mail follows:


Hi all,

How could I connect Linux/Apache/PHP with Unix(HP-UX)/AdasbasD? I need ODBC ? How do I indicate the PATH of Adabas that is in the HP-UX to compile the PHP(--with-adabas=DIR)?

Thanks

Valdemir Augusto Castilho Brazil

attached mail follows:


At 8:18 PM +0000 4/7/00, SANIsoft wrote: >Hello > >Is there any PHP base majordomo list archiever around > >OR any sensible way to archive a mailing list in PHP3 > >Thanks in advance >

I don't have the project completed, but here is an approach I am taking to archive emails into MySQL using PHP. (I know I could use Perl for this also, but this seemed a neat solution, and I didn't have to mess with any Perl modules.)

Here is the script I am using (you'll have to set paths as appropriate to your server):

#!/path/to/httpd/cgi-bin/php <?php $fp = fopen("/dev/stdin", "r"); if ($fp > 0) { while(!feof($fp)) { if (!isset($body)) { $lineets($fp, 120); if(ereg("^From:(.+)",$line)) { $lineeg_replace("From:","",$line); $line=trim($line); $lineeg_replace ("\\\n","",$line); $line­dslashes($line); $sender=$line; } if(ereg("^Subject:(.+)",$line)) { $lineeg_replace("Subject:","",$line); $line=trim($line); $lineeg_replace ("\\\n","",$line); $line­dslashes($line); $subject=$line; } if(ereg("^\\\n",$line)) { $body=""; } } else { $lineets($fp, 120); $line­dslashes($line); $body.=$line; } } fclose($fp); $test=mysql_connect("localhost","user","pass"); $now=time(); $sql="INSERT INTO archive VALUES('','$sender','$subject','$body',$now)"; $result=mysql_db_query("mail",$sql); } ?>

As you can see by defining the path, it is interpreted directly by the php executable. This script reads STDIN until reaching the end of the file, grabs the From and Subject headers, and creates the body once it detects the end of the headers.

I set up an alias in my sendmail aliases file to pipe the mail to the script like this:

archive: "|/path/to/archive_script.php3"

The MySQL schema is:

CREATE TABLE archive ( ID int(14) DEFAULT '0' NOT NULL auto_increment, sender varchar(60) NOT NULL, subject varchar(255) NOT NULL, body text NOT NULL, unix_time int(14) DEFAULT '0' NOT NULL, PRIMARY KEY (ID), KEY sender (sender), KEY subject (subject) );

I haven't worked on the web archive end yet, but this works well in archiving the mail.

attached mail follows:


Here is my approach. I am working on writing such a program, but don't have a lot of free time right now. Here are my functions to parse the mail, I believe them to be pretty accurate but haven't tested them real well. The general idea is to have a parsing function return an array with the index being a string of the header name or body. This should also properly merge multiple headers (such as a recieved trail).

<?php

## ## Parses a message to return an array containing one entry ## for each header as well as an entry for the body ##

function parseMessage($message) { $lines = explode("\n", $message); while (list(,$line) = each($lines)) { if ($line == "") { ## Empty line signals break; ## end of headers }

if (strspn($line, " \t") > 0) { ## Starts with whitespace, $return[$last] .= $line; ## continuation of last header } elseif (preg_match("/^([^:\s]+):\s*(.*\S)\s*$/m", $line, $fields)) { isset($return[$fields[1]]) ? $return[$fields[1]] .= ",\n" . $fields[2] : $return[$fields[1]] = $fields[2]; }

$last = $fields[1]; }

## The rest is just the body, loop through and get it

while (list(,$line) = each($lines)) { $return["body"] .= $line . "\n"; }

if (isset($return["From"])) { $temp = parseFrom($return["From"]); $return["Email"] = $temp[0]; $return["Name"] = $temp[1]; } /* make sure the mail client hasn't done anything funky with the Reply-To header as they often like to do */ return $return; } ## ## This takes the from header for the message, and attempts to parse it ## into an email address and a name. It's fairly complicated to attempt ## to correctly parse any format you're likely to encounter. If it fails, ## then the entire From: header is returned for both the name and email. ##

function parseFrom($from) {

preg_match("/([a-z0-9_\-\.\+]+[a-z0-9_\-\.]+\.{1}[a-z]{2,4})/i",$from, $ema il); $name = preg_replace("/[\(<]?([a-z0-9_\-\.\+]+[a-z0-9_\-\.]+\.{1}[a-z]{2,4})[\)>]?/i", "", $from); $return[0] = $email[1]; $return[1] = $name; return $return; }

On Fri, 7 Apr 2000, Ed Trefzger wrote:

> At 8:18 PM +0000 4/7/00, SANIsoft wrote: > >Hello > > > >Is there any PHP base majordomo list archiever around > > > >OR any sensible way to archive a mailing list in PHP3 > > > >Thanks in advance > > > > I don't have the project completed, but here is an approach I am > taking to archive emails into MySQL using PHP. (I know I could use > Perl for this also, but this seemed a neat solution, and I didn't > have to mess with any Perl modules.) > > Here is the script I am using (you'll have to set paths as > appropriate to your server): > > #!/path/to/httpd/cgi-bin/php > <?php > $fp = fopen("/dev/stdin", "r"); > if ($fp > 0) { > while(!feof($fp)) { > if (!isset($body)) { > $line=fgets($fp, 120); > if(ereg("^From:(.+)",$line)) { > $line=ereg_replace("From:","",$line); > $line=trim($line); > $line=ereg_replace ("\\\n","",$line); > $line=addslashes($line); > $sender=$line; > } > if(ereg("^Subject:(.+)",$line)) { > $line=ereg_replace("Subject:","",$line); > $line=trim($line); > $line=ereg_replace ("\\\n","",$line); > $line=addslashes($line); > $subject=$line; > } > if(ereg("^\\\n",$line)) { > $body=""; > } > } > else { > $line=fgets($fp, 120); > $line=addslashes($line); > $body.=$line; > } > } > fclose($fp); > $test=mysql_connect("localhost","user","pass"); > $now=time(); > $sql="INSERT INTO archive VALUES('','$sender','$subject','$body',$now)"; > $result=mysql_db_query("mail",$sql); > } > ?> > > As you can see by defining the path, it is interpreted directly by > the php executable. This script reads STDIN until reaching the end > of the file, grabs the From and Subject headers, and creates the body > once it detects the end of the headers. > > I set up an alias in my sendmail aliases file to pipe the mail to the > script like this: > > archive: "|/path/to/archive_script.php3" > > The MySQL schema is: > > CREATE TABLE archive ( > ID int(14) DEFAULT '0' NOT NULL auto_increment, > sender varchar(60) NOT NULL, > subject varchar(255) NOT NULL, > body text NOT NULL, > unix_time int(14) DEFAULT '0' NOT NULL, > PRIMARY KEY (ID), > KEY sender (sender), > KEY subject (subject) > ); > > I haven't worked on the web archive end yet, but this works well in > archiving the mail. > >

-- 

Chad Cunningham ccunningmath.ohio-state.edu

Only 165 days until RSA Patent expiration!

attached mail follows:


For my PHP friends in the USA: Here's a form you can use to lookup the exact Zip+4 codes, below. All it needs is a street address and 5-digit zipcode.

But my question for the PHP list is... HOW CAN WE USE THIS SEAMLESSLY?

Any way, once someone has typed their address into our regular order form, to have it automatically consult this website and return their Zip+4?

Take a hack at it... (All hidden fields and names must remain as-is.)

<FORM NAME="Table1FORM" ACTION="http://www.framed.usps.com/cgi-bin/zip4/zip4inq2" METHOD=POST> <INPUT id="FormsEditField6" TYPE="hidden" NAME="Firm" VALUE=""> <INPUT id="FormsEditField7" TYPE="hidden" NAME="Urbanization">

<p>Street Address:<br> <INPUT id="FormsEditField8" TYPE="text" NAME="Delivery Address" VALUE="" SIZE=30 MAXLENGTH=40 > <p>

<INPUT id="FormsEditField9" TYPE="hidden" NAME="City" VALUE=""> <INPUT id="FormsComboBox2" TYPE="hidden" NAME="State" VALUE="">

<p>Zip Code:<br> <INPUT id="FormsEditField11" TYPE="text" NAME="Zip Code" VALUE="" SIZE=10 MAXLENGTH=10 > <p> <INPUT TYPE="submit" NAME="Submit" VALUE="Process" id="FormsButton2">

attached mail follows:


Well, you use file() to read the url and imbed it in a page, then intercept the post and grab the submitted url.

that is, first grab $page = file("http://blah.com/blah");

then intercept the post vars and grab $file = file("http://blah.com/blah?foo=bar&winnie=pooh");

that's it. Oh, use regex to rewrite the links. I have already written a class to do this for mapquest pages. if you're interested, I'll modify it and send it to you to work with this page. should be easy.

ryan gaul

on 4/7/00 2:08 PM, Derek Sivers at listhitmedia.com wrote:

> For my PHP friends in the USA: > Here's a form you can use to lookup the exact Zip+4 codes, below. > All it needs is a street address and 5-digit zipcode. > > But my question for the PHP list is... > HOW CAN WE USE THIS SEAMLESSLY? > > Any way, once someone has typed their address into our regular order form, > to have it automatically consult this website and return their Zip+4? > > Take a hack at it... > (All hidden fields and names must remain as-is.) > > > > <FORM NAME="Table1FORM" > ACTION="http://www.framed.usps.com/cgi-bin/zip4/zip4inq2" METHOD=POST> > <INPUT id="FormsEditField6" TYPE="hidden" NAME="Firm" VALUE=""> > <INPUT id="FormsEditField7" TYPE="hidden" NAME="Urbanization"> > > <p>Street Address:<br> > <INPUT id="FormsEditField8" TYPE="text" NAME="Delivery Address" VALUE="" > SIZE=30 MAXLENGTH=40 > > <p> > > <INPUT id="FormsEditField9" TYPE="hidden" NAME="City" VALUE=""> > <INPUT id="FormsComboBox2" TYPE="hidden" NAME="State" VALUE=""> > > <p>Zip Code:<br> > <INPUT id="FormsEditField11" TYPE="text" NAME="Zip Code" VALUE="" SIZE=10 > MAXLENGTH=10 > > <p> > <INPUT TYPE="submit" NAME="Submit" VALUE="Process" id="FormsButton2"> > >

attached mail follows:


use snoopy or one of the http protocol script at upperdesign.com to simulate a http session, submit the form, then parse the returned html and snip out the relevant parts. snoopy is on freshmeat.net.

At 03:08 PM 4/7/00 -0400, Derek Sivers wrote: >For my PHP friends in the USA: >Here's a form you can use to lookup the exact Zip+4 codes, below. >All it needs is a street address and 5-digit zipcode. > >But my question for the PHP list is... >HOW CAN WE USE THIS SEAMLESSLY? > >Any way, once someone has typed their address into our regular order form, >to have it automatically consult this website and return their Zip+4? > >Take a hack at it... >(All hidden fields and names must remain as-is.) > > > ><FORM NAME="Table1FORM" >ACTION="http://www.framed.usps.com/cgi-bin/zip4/zip4inq2" METHOD=POST> ><INPUT id="FormsEditField6" TYPE="hidden" NAME="Firm" VALUE=""> ><INPUT id="FormsEditField7" TYPE="hidden" NAME="Urbanization"> > ><p>Street Address:<br> ><INPUT id="FormsEditField8" TYPE="text" NAME="Delivery Address" VALUE="" >SIZE=30 MAXLENGTH=40 > ><p> > ><INPUT id="FormsEditField9" TYPE="hidden" NAME="City" VALUE=""> ><INPUT id="FormsComboBox2" TYPE="hidden" NAME="State" VALUE=""> > ><p>Zip Code:<br> ><INPUT id="FormsEditField11" TYPE="text" NAME="Zip Code" VALUE="" SIZE=10 >MAXLENGTH=10 > ><p> ><INPUT TYPE="submit" NAME="Submit" VALUE="Process" id="FormsButton2"> > > > >-- >PHP 3 Mailing List <http://www.php.net/> >To unsubscribe, send an empty message to php3-unsubscribelists.php.net >To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net >To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 >To contact the list administrators, e-mail: php-list-adminlists.php.net

attached mail follows:


On 7 Apr 00, at 10:01, Michael P. Korpics wrote:

> I've now tried the following code on two different machines with the same > result (MySQL Connection Failed: Can't connect to local MySQL server through > socket '/var/lib/mysql/mysql.sock' ). Here's the code:

You may have already checked this, but make sure your mysql.sock is in /var/lib/mysql/. If it's not you will get this error.

You can call $connection = mysql_connect("localhost:/tmp/mysql.sock","webuser","") if your sock file is in /tmp/

Good Luck -burk

P.S. You probably already know this, but you can find mysql.sock by: find / -name "mysql.sock"

attached mail follows:


On Fri, 7 Apr 2000, burk wrote:

> On 7 Apr 00, at 10:01, Michael P. Korpics wrote: > > > I've now tried the following code on two different machines with the same > > result (MySQL Connection Failed: Can't connect to local MySQL server through > > socket '/var/lib/mysql/mysql.sock' ). Here's the code: > > You may have already checked this, but make sure your mysql.sock is > in /var/lib/mysql/. If it's not you will get this error. > > You can call > $connection = mysql_connect("localhost:/tmp/mysql.sock","webuser","") > if your sock file is in /tmp/ >

My problem was just the opposite. My mysql.sock file was in /var/lib/mysql/mysql.sock, but the MySQL server looked in /tmp/mysql.sock.

I just 'ln -s /var/lib/mysql/mysql.sock /tmp/mysql' and that fixed it.

Try something similar on your machine.

J. J. Horner Linux, Apache, Perl, Unix, Stronghold jhornerknoxlug.org http://www.knoxlug.org System has been up: 6 days.

attached mail follows:


> > You can call > $connection = mysql_connect("localhost:/tmp/mysql.sock","webuser","") > if your sock file is in /tmp/

Don't do this .... I had the same problem, and it was resolved by using:

mysql_connect("127.0.0.1:/path/to/mysql/sock.sock", "blah", "blah");

Note the use of 127.0.0.1 instead of localhost.

Cheerz! Larry

attached mail follows:


-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Then you do not have localhost defined properly in your DNS or HOSTS file... as localhost should be equal to 127.0.0.1

James

> -----Original Message----- > From: rootmorpheus.passageway.com > [mailto:rootmorpheus.passageway.com]On Behalf Of Wimble > Sent: Friday, April 07, 2000 2:03 PM > To: burk > Cc: php3lists.php.net > Subject: Re: [PHP3] MySQL connect woes continue > > > > > > You can call > > $connection = > mysql_connect("localhost:/tmp/mysql.sock","webuser","") > > if your sock file is in /tmp/ > > Don't do this .... I had the same problem, and it was resolved > by using: > > mysql_connect("127.0.0.1:/path/to/mysql/sock.sock", "blah", "blah"); > > Note the use of 127.0.0.1 instead of localhost. > > Cheerz! > Larry > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to > php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: > php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-adminlists.php.net

-----BEGIN PGP SIGNATURE----- Version: PGP 6.0.2

iQA/AwUBOO5Ik7ES610nakSWEQJ0OgCdFQMeE34Pna8IXLHe1LIEmWM1lDMAnifK CLZ8KA5P6Ec99NDGTSbORPhx =Kclb -----END PGP SIGNATURE-----

attached mail follows:


Hi,

I am trying to install Apache + mod_ssl + mysql + php3 using the instructions from mod_ssl.. This is the error I get when trying to start up apache.. Any ideas?

$ ./apachectl startssl /etc/httpd/bin/httpd: error in loading shared libraries: /usr/lib/apache/imap.so: undefined symbol: php3_register_long_constant ./apachectl startssl: httpd could not be started

Thanks..

--
Ashwin
kutty..
Systems Administrator
Dalhousie University Libraries

attached mail follows:


I just saw an article on a new Macromedia product coming out called UltraDev.  I believe it will be more of an IDE then Dreamweaver.  They are saying you it is a development tool for web apps.  They are talking about support for ASP, JSP, and CFML.  I believe this would be a great tool to get PHP built into. 

http://www.macromedia.com/software/ultradev/ is the page on Macromedia's site.

So anyone interested in a good cross platform (Mac/Win) IDE for PHP please email customerservicemacromedia.com and ask for PHP support in UltraDev.

Michael

> Vadim Tkachenko wrote: > > /ASP, but is longer developing than JSP/ASP, > not because PHP is not powerfull but >there is no good IDE. > > > > > >

attached mail follows:


I just saw an article on a new Macromedia product coming out called UltraDev.  I believe it will be more of an IDE then Dreamweaver.  They are saying you it is a development tool for web apps.  They are talking about support for ASP, JSP, and CFML.  I believe this would be a great tool to get PHP built into. 

http://www.macromedia.com/software/ultradev/ is the page on Macromedia's site.

So anyone interested in a good cross platform (Mac/Win) IDE for PHP please email customerservicemacromedia.com and ask for PHP support in UltraDev.

Michael

attached mail follows:


Hello Martin,

On 07-Apr-00 09:24:27, you wrote:

>> > Hey guys.. php/mysql, what is the best ay that i can do a query just to >> > get the maximum value of a auto_increment primary key? (the last id

>Well, why not use: >"select max(id) as max_id from column"

>It should give you the largest id from a particular column...

This is dangerous. If a concurrent process adds another row to table you might just get the id inserted by the concurrent process which is different than the current process.

You ought to use mysql_insert_id() instead.

Regards, Manuel Lemos

Web Programming Components using PHP Classes. Look at: acm.org">http://phpclasses.UpperDesign.com/?user=mlemosacm.org

--
E-mail: mlemosacm.org
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--

attached mail follows:


I'm a newbie at databases. Why is it dangerous to get an id of row inserted by another process?

At 10:12 7.4.2000 -0200, Manuel Lemos wrote the following: -------------------------------------------------------------- >Hello Martin, > >On 07-Apr-00 09:24:27, you wrote: > > >> > Hey guys.. php/mysql, what is the best ay that i can do a query just to > >> > get the maximum value of a auto_increment primary key? (the last id > > > >Well, why not use: > >"select max(id) as max_id from column" > > >It should give you the largest id from a particular column... > >This is dangerous. If a concurrent process adds another row to table >you might just get the id inserted by the concurrent process which is >different than the current process. > >You ought to use mysql_insert_id() instead. > >Regards, >Manuel Lemos > >Web Programming Components using PHP Classes. >Look at: acm.org">http://phpclasses.UpperDesign.com/?user=mlemosacm.org >-- >E-mail: mlemosacm.org >URL: http://www.mlemos.e-na.net/ >PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp >-- > > >-- >PHP 3 Mailing List <http://www.php.net/> >To unsubscribe, send an empty message to php3-unsubscribelists.php.net >To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net >To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 >To contact the list administrators, e-mail: php-list-adminlists.php.net ------end of quote------ ____________________________________________________________ Cynic:

A member of a group of ancient Greek philosophers who taught that virtue constitutes happiness and that self control is the essential part of virtue.

cynicmail.cz ICQ: 2808 2505

attached mail follows:


> I'm a newbie at databases. Why is it dangerous to get > an id of row inserted by another process?

Lets say that when you insert your record, that record is the 99th in the table. In the time it takes your code to query the DB for the total records, another process inserts a record into that same table. Yours is the 99th record, but the table now has 100. So when your query executes and you get the return value, it will be 100 and you will be working with a completely different record. The only way to reliably get the information you seek is to make sure that the table has an auto_increment field and you use the function mysql_insert_id(). Otherwise, you are just opening yourself up to a world of grief later one.

Chris

attached mail follows:


> the table has an auto_increment field and you use the > function mysql_insert_id(). Otherwise, you are just opening > yourself up to a world of grief later one.

Necessary qualification: use the mysql_insert_id() function if you are using the mysql library. Other DB functions have something similar, I'm sure.

Chris

attached mail follows:


Well, without looking in the original post I remember that the author didn't want to use this function (for some reason). I was about to suggest mysql_insert_id() myself as well...

-- Martin

----- Original Message ----- From: "Manuel Lemos" <mlemosacm.org> To: "Martin Edelius" <php3lists.php.net> Cc: <patrickkarlshof.de>; <peaslinux.ime.usp.br> Sent: Friday, April 07, 2000 2:12 PM Subject: Re: [PHP3] Getting the last ID inserted from an specified table... help

> Hello Martin, > > On 07-Apr-00 09:24:27, you wrote: > > >> > Hey guys.. php/mysql, what is the best ay that i can do a query just to > >> > get the maximum value of a auto_increment primary key? (the last id > > > >Well, why not use: > >"select max(id) as max_id from column" > > >It should give you the largest id from a particular column... > > This is dangerous. If a concurrent process adds another row to table > you might just get the id inserted by the concurrent process which is > different than the current process. > > You ought to use mysql_insert_id() instead. > > Regards, > Manuel Lemos > > Web Programming Components using PHP Classes. > Look at: acm.org">http://phpclasses.UpperDesign.com/?user=mlemosacm.org > -- > E-mail: mlemosacm.org > URL: http://www.mlemos.e-na.net/ > PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp > -- > > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net > >

attached mail follows:


Greetings all,

I need some help with HTTP transactions. I am opening a socket and using fputs to send a request to a URL. Like such:

// try to connect to Web server $connection = fsockopen("www.somedomain.com", 80, &$error_number, &$error_description);

// send transaction fputs($connection, "GET /test/testOAS?123\r\n"); fputs($connection, "\r\n");

this works fine. I attempted to simply change the method to a POST and send the data on another line but it ignores the data sent.

// try to connect to Web server $connection = fsockopen("www.somedomain.com", 80, &$error_number, &$error_description);

// send transaction fputs($connection, "POST /test/testOAS\r\n"); fputs($connection, "123\r\n"); fputs($connection, "\r\n");

This hit the URL but the data attached, "123", was ignored. What is the correct syntax for appending data to a post transaction. I have attemped to read the rfc from www.w3.org but I'm still having a hard time.

Thanks, Pete Tamisin peter.tamisinknowledgestorm.com

attached mail follows:


hey, all

I want to be able to give users the possibility to get there pasword send to them when the forgot it. I also want to store this pasword encrypted in the database so I need a good way to decode/undecode this string. md5 is one way encryption isn't it ? or are there works around for this problem

regards jeroen olthof

attached mail follows:


Jeroen Olthof wrote: > > hey, all > > I want to be able to give users the possibility to get there pasword > send to them when the forgot it. I also want to store this pasword > encrypted in the database so I need a good way to decode/undecode this > string. md5 is one way encryption isn't it ? or are there works around > for this problem

In general, storing passwords is always a bad thing. If you want to make a two-way cipher system, you can, but it's going to be much, much, much, weaker.

Here's what I'd suggest doing instead: If they loose their passwords, generate a new one and send that to them....

Now that I've done the responsible warning thing, you can use encrypt() and decrypt() on *nix for less secure requirements... http://www.php.net/manual/html/ref.mcrypt.html

-Bop

--
Brought to you from boop!, the dual boot Linux/Win95 Compaq Presario 1625
laptop, currently running RedHat 6.1. Your bopping may vary.

attached mail follows:


Hello to all; I'm just new to PHP so please be gentle with me. I have just converted a web site over to PHP3 and am using some very cool scripts. However my internal page links ,ie. "aboutus2.php#manage" no longer work at all. I have changed the file extension from .html to .php and have tried .php3 but these links will not work. As soon as I change the page extensions and link extensions bakc to .html it works fine. What am I doing wrong?

mayakovski

attached mail follows:


I am trying to define a constant within the constructor of a class so that I can use this contant in both the class and any other code. However refering to the contant inside tha clas that defined is doesn't return the value of the constant, but the name of the constant.

Like this:

class World {

function World() { define("GREETING", "Hello World!"); }

function sayHello() { echo GREETING; }

}

$myWorld = new World;

This: $myWorld->sayHello(); returns: GREETING

While this echo GREETING; returns Hello World!

I can work around this by making CONSTANT a global variable, but then I loose the benefits of a constant.. Am I doing something wrong?

Tina.

attached mail follows:


You can use define() outside your class definition to specify your CONSTANTs and they will be available to all of your classes. To quote the manual:

"Constants may be accessed anywhere without regard to variable scoping rules."

Therefore there is no need to define your constants within your class. They are already available.

--Vamsi

----- Original Message ----- From: "Tina Ruth-Gunnarsson" <truthmultifin.com> To: <php3lists.php.net> Sent: Friday, April 07, 2000 4:09 PM Subject: [PHP3] php3.0.15: Constants and classes

> I am trying to define a constant within the constructor of a class so > that I can use this contant in both the class and any other code. > However refering to the contant inside tha clas that defined is doesn't > return the value of the constant, but the name of the constant. > > Like this: > > class World { > > function World() { > define("GREETING", "Hello World!"); > } > > function sayHello() { > echo GREETING; > } > > } > > $myWorld = new World; > > This: > $myWorld->sayHello(); > returns: GREETING > > While this > echo GREETING; > returns Hello World! > > I can work around this by making CONSTANT a global variable, but then I > loose the benefits of a constant.. > Am I doing something wrong? > > Tina. > > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net

attached mail follows:


Hi,

Has anyone managed to use fsockopen with the service at www.dyndns.org - I can't work out what port I should connect to..any ideas?

Will

--
William Luke
Lukrative Media Ltd - Making it a Lukrative Internet
http://www.lukrative.com

attached mail follows:


James Conner wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Then you do not have localhost defined properly in your DNS or HOSTS > file... as localhost should be equal to 127.0.0.1 >

Dunno what to tell ya .... /etc/hosts looks good (as also evidenced by a successful "ping localhost"), and what I wrote earlier about the mysql_connect call seems to have solved the problem....

Larry

attached mail follows:


My problems went away when I switched back to Apache 1.3.6, PHP-3.0.7, MySQL-3.22.22. I tried re-compiling and switching back and forth between the latest stuff and this setup. Every time this config would work and the latest stuff wouldn't. I'll have to try using just the IP and not the hostname, but that doesn't make any sense.

Michael P. Korpics Expert Choice, Inc. korpicsexpertchoice.com http://www.expertchoice.com

On Fri, 7 Apr 2000, Wimble wrote:

> James Conner wrote: > > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Then you do not have localhost defined properly in your DNS or HOSTS > > file... as localhost should be equal to 127.0.0.1 > > > > Dunno what to tell ya .... /etc/hosts looks good (as also evidenced by a > successful "ping localhost"), and what I wrote earlier about the > mysql_connect call seems to have solved the problem.... > > Larry > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net >

attached mail follows:


Hi, I was trying to know if there is a way to configure xemacs to "syntax highlight" the php3 tags like it does with other languages (C,HTML...)

Thanks for your time...

Best Regards, Gianmarco Giovannelli , "Unix expert since yesterday" http://www.giovannelli.it/~gmarco http://www2.masternet.it

attached mail follows:


Hi,

I am new to PHP. I am running PHP 3.0.12 against a MySQL database 3.22.27 and an Apache Web server 1.3.9.

After inserting a record in the database I go to another PHP script that shows me the contents of the database table in HTML table format. If I have loaded this script previously the screen does not refresh. I seems to use the result set I have created previously. Does anybody know how I can change this ? Is this a MySQL setting or a PHP setting or an Apache thing. I assume a PHP one because I have another script that creates me exactly the same HTML table but using Perl and that works fine.

Regards, Joris.

attached mail follows:


i'm trying to install php3 and php4 under the same apache. According to the notes, i need to do this as a DSO, which i have no experience with. i think my issue is with apache. i've compiled apache using this configuration:

./configure --prefix=/usr/local/apacheDSO --enable-rule=SHARED_CORE

the server works, but when i try to install either php3 or php4 using this:

./configure --with-apxs=/usr/local/apacheDSO/bin/apxs --enable-versioning --with-mysql --with-imap --enable-track-vars

it complains that my apxs is broken and directs me to a FAQ page(http://www.php.net/FAQ.php3#4.11). Unfortunately the advise in the FAQ does not apply. Has any one seen this before? Are there any other possibilities or ways that i can work through this problem? Also, is my apache built correctly?? i appreciate any help that anyone can offer me.

-- 
~darcy w. christ
Elegant Communications Inc.
416.362.9772 x222 | 416.362.8324 fax

attached mail follows:


Add --enable-module=so to your Apache ./configure line and get rid of that SHARED_CODE stuff and it should work fine.

-Rasmus

On Fri, 7 Apr 2000, darcy w. christ wrote:

> i'm trying to install php3 and php4 under the same apache. According to > the notes, i need to do this as a DSO, which i have no experience with. > i think my issue is with apache. i've compiled apache using this > configuration: > > ./configure --prefix=/usr/local/apacheDSO --enable-rule=SHARED_CORE > > the server works, but when i try to install either php3 or php4 using > this: > > ./configure --with-apxs=/usr/local/apacheDSO/bin/apxs > --enable-versioning --with-mysql --with-imap --enable-track-vars > > it complains that my apxs is broken and directs me to a FAQ > page(http://www.php.net/FAQ.php3#4.11). Unfortunately the advise in the > FAQ does not apply. Has any one seen this before? Are there any other > possibilities or ways that i can work through this problem? Also, is my > apache built correctly?? i appreciate any help that anyone can offer > me. > > -- > ~darcy w. christ > Elegant Communications Inc. > 416.362.9772 x222 | 416.362.8324 fax > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net > >

attached mail follows:


Hi

I was visiting http://WWW.DRIVEWAY.COM and saw a very cool feature. You can upload files to this site but the cool feature is that when you start the upload, a small browser window jumps and shows you the progress.

you can see an example of such a window here :

http://www.weberdev.com/UploadProgress.jpg

Does anyone have an idea how to create such a window? Can this be done with PHP?

thanks

berber

attached mail follows:


It cannot be done with PHP

On Sat, 8 Apr 2000, Boaz Yahav wrote:

> Hi > > I was visiting http://WWW.DRIVEWAY.COM and saw a very cool feature. > You can upload files to this site but the cool feature is that when you > start > the upload, a small browser window jumps and shows you the progress. > > you can see an example of such a window here : > > http://www.weberdev.com/UploadProgress.jpg > > > Does anyone have an idea how to create such a window? > Can this be done with PHP? > > thanks > > berber > > >

-- 
Zeev Suraski <zeevzend.com>
http://www.zend.com/

attached mail follows:


At 12:17 AM 4/8/00 +0200, Boaz Yahav wrote: >Hi > >I was visiting http://WWW.DRIVEWAY.COM and saw a very cool feature. >You can upload files to this site but the cool feature is that when you >start >the upload, a small browser window jumps and shows you the progress. > >you can see an example of such a window here : > >http://www.weberdev.com/UploadProgress.jpg > > >Does anyone have an idea how to create such a window? >Can this be done with PHP?

I built a little application like you describe a year or so ago using JavaScript. Use onClick in your submit tag to call a function that generates a pop-up window. Use onUnload in your body tag to close the window when the upload page gets replaced by the result page.

HTH,

Zak

attached mail follows:


At 1:24 AM +0300 4/8/00, Zeev Suraski wrote: >It cannot be done with PHP > >On Sat, 8 Apr 2000, Boaz Yahav wrote: > > > Hi > > > > I was visiting http://WWW.DRIVEWAY.COM and saw a very cool feature. > > You can upload files to this site but the cool feature is that when you > > start > > the upload, a small browser window jumps and shows you the progress. > > > > you can see an example of such a window here : > > > > http://www.weberdev.com/UploadProgress.jpg > > > > > > Does anyone have an idea how to create such a window? > > Can this be done with PHP? > > > > thanks > > > > berber > >

I'd bet this was done with an ActiveX applet (since you were evidently using MS-IE)...but you could do a similar thing with a Java Applet. I recall, about a year or so ago, a discussion of 'upload status bars' or 'progress bars' on the PHP list; there may have been links to some code to do this. To repeat the mantra, 'search the archives' :)

> >-- >Zeev Suraski <zeevzend.com> >http://www.zend.com/ >

+---------------- Splurk! Glort! Klikrunk! Ploip! Katoong!---------------+ | Steve Edberg University of California, Davis | | sbedbergucdavis.edu (530)754-9127 | | Computer Consultant http://aesric.ucdavis.edu/ | +------------------ Don Martin 18 May 1931 - 7 Jan 2000 -----------------+

attached mail follows:


java or javascript would do the job

At 12:17 AM 4/8/00 +0200, Boaz Yahav wrote: >Hi > >I was visiting http://WWW.DRIVEWAY.COM and saw a very cool feature. >You can upload files to this site but the cool feature is that when you >start >the upload, a small browser window jumps and shows you the progress. > >you can see an example of such a window here : > >http://www.weberdev.com/UploadProgress.jpg > > >Does anyone have an idea how to create such a window? >Can this be done with PHP? > >thanks > >berber > > >-- >PHP 3 Mailing List <http://www.php.net/> >To unsubscribe, send an empty message to php3-unsubscribelists.php.net >To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net >To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 >To contact the list administrators, e-mail: php-list-adminlists.php.net

attached mail follows:


Hi I need some help I want to install php3 and xml on apache server. Php3 on apache server is working great, but i am facing problems with XML. I am not able to configure it. when i say ./configure --with-xml it is giving error as "cannot find XML include files". I have assigned values for CPPFLAFS and LDFLAGS also.

Can anyone help me out regarding this

thanks anu

______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com

attached mail follows:


For anyone's future reference:

My problem went away when I substituted 127.0.0.1 for localhost in the mysql_connect string.

----- Original Message ----- From: Herman Roberts <hermanhollysoft.com> To: PHP3 <php3lists.php.net> Sent: Thursday, April 06, 2000 5:02 AM Subject: [PHP3] mysql_connect fails in PHP3 cgi run from unix command line

> I am using a website hosting service and I have php 3.0.7 working both via > Apache and from the command line interactively on their unix (bsdi bsd/os > 3.1 Virtual Kernel). I also have MySQL 3.22.25 working just fine > interactively or via php3 run by Apache. However: mysql_connect commands > fail when scripts are run from the command line interactively. (Warning: > MySQL Connection Failed: Can't connect to local MySQL server in script_name > on line line_nbr) > > I was sure I had a problem w/ hostname/username/password but a copy of the > very same script (w/o the top #! line, of course) run by Apache runs fine. > I also ran a simple script w/ a php_info() from the command line and the > results indicate that mysql support is available w/ no problems. > > I am fairly sure Apache was compiled w/ mod-php3 (and mod-mysql) included. > I would have tried a dl('mysql.so') because I do not have a mysql.so on my > server at this time. I'm not even sure I'm "allowed" to recompile php on > this server. > > <cut>

attached mail follows:


Do you have localhost defined in your /etc/hosts file?

Brandt

-----Original Message----- From: Herman-HollySoft [mailto:hermanhollysoft.com] Sent: Friday, April 07, 2000 4:02 PM To: PHP3 Subject: [PHP3] mysql_connect fails in PHP3 cgi run from unix command line

For anyone's future reference:

My problem went away when I substituted 127.0.0.1 for localhost in the mysql_connect string.

----- Original Message ----- From: Herman Roberts <hermanhollysoft.com> To: PHP3 <php3lists.php.net> Sent: Thursday, April 06, 2000 5:02 AM Subject: [PHP3] mysql_connect fails in PHP3 cgi run from unix command line

> I am using a website hosting service and I have php 3.0.7 working both via > Apache and from the command line interactively on their unix (bsdi bsd/os > 3.1 Virtual Kernel). I also have MySQL 3.22.25 working just fine > interactively or via php3 run by Apache. However: mysql_connect commands > fail when scripts are run from the command line interactively. (Warning: > MySQL Connection Failed: Can't connect to local MySQL server in script_name > on line line_nbr) > > I was sure I had a problem w/ hostname/username/password but a copy of the > very same script (w/o the top #! line, of course) run by Apache runs fine. > I also ran a simple script w/ a php_info() from the command line and the > results indicate that mysql support is available w/ no problems. > > I am fairly sure Apache was compiled w/ mod-php3 (and mod-mysql) included. > I would have tried a dl('mysql.so') because I do not have a mysql.so on my > server at this time. I'm not even sure I'm "allowed" to recompile php on > this server. > > <cut>

--
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribelists.php.net
To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net
To search the mailing list archive, go to:
http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-adminlists.php.net

attached mail follows:


This problem drove me nuts too. I believe it is MySQL that changed how it checks access (perhaps with the 3.22.27 security fix). Using 'localhost' for grant in mysql and mysql_connect in php used to work, but now 'localhost.localdomain' or 127.0.0.1 work for grant and mysql_connect. /etc/hosts on redhat systems (and i believe most others) has localhost defined as: 127.0.0.1 localhost.localdomain localhost

This has been the same for as long as i can remember. This should definitely be in the FAQ for mysql and php. I wasn't getting an access denied error, just wouldn't work with just 'localhost'. I'm that'll drive alot of other people nuts too.

Michael P. Korpics Expert Choice, Inc. korpicsexpertchoice.com http://www.expertchoice.com

On Fri, 7 Apr 2000, Brandt Everett wrote:

> Do you have localhost defined in your /etc/hosts file? > > Brandt > > > -----Original Message----- > From: Herman-HollySoft [mailto:hermanhollysoft.com] > Sent: Friday, April 07, 2000 4:02 PM > To: PHP3 > Subject: [PHP3] mysql_connect fails in PHP3 cgi run from unix command > line > > > For anyone's future reference: > > My problem went away when I substituted 127.0.0.1 for localhost in the > mysql_connect string. > > ----- Original Message ----- > From: Herman Roberts <hermanhollysoft.com> > To: PHP3 <php3lists.php.net> > Sent: Thursday, April 06, 2000 5:02 AM > Subject: [PHP3] mysql_connect fails in PHP3 cgi run from unix command line > > > > I am using a website hosting service and I have php 3.0.7 working both via > > Apache and from the command line interactively on their unix (bsdi bsd/os > > 3.1 Virtual Kernel). I also have MySQL 3.22.25 working just fine > > interactively or via php3 run by Apache. However: mysql_connect commands > > fail when scripts are run from the command line interactively. (Warning: > > MySQL Connection Failed: Can't connect to local MySQL server in > script_name > > on line line_nbr) > > > > I was sure I had a problem w/ hostname/username/password but a copy of the > > very same script (w/o the top #! line, of course) run by Apache runs fine. > > I also ran a simple script w/ a php_info() from the command line and the > > results indicate that mysql support is available w/ no problems. > > > > I am fairly sure Apache was compiled w/ mod-php3 (and mod-mysql) included. > > I would have tried a dl('mysql.so') because I do not have a mysql.so on my > > server at this time. I'm not even sure I'm "allowed" to recompile php on > > this server. > > > > <cut> > > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: > http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net > > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net >

attached mail follows:


Hi everyone,

Does anyone know of a good form generator that generates nice looking html forms and handles multiple forms. As an example:

ID: Company: Date:

Part# Qty Price _______ ___ _____

The two forms i.e. Inv.header and Inv.detail have a one to many relationship.

Thanks;

attached mail follows:


Hi ,

I can say that since I have found about PHP and MySQL I got a lot more interested in site and database design and as it is something I am looking into then maks it even better.

The problem that I have is loding MySQL server and PHP nothing seemed to respond to the any of the help files that I tried to use on the WEB and the readme files that are listed with install files. I have also tried to use SQL server and Microsoft Access ODBC and then at the end I have tried downloading one of the drivers from the site (myodbc-2.50.29-win95). Is it possible that the problem lies in setting the server and the host? Using the file above I get question on DNS and host name and database location and whatever I try it does not help same message appears no host can be found.

I am using all this on the Windows 98 machine (Compaq laptop 1245) this is used for development. And one more thing that using manual I got a question .... Once all this is working do you just create file anywhere and save it as extension php3 or phtml which one of them is corect when you use MySQL and PHP3? Am I better of with PHP4 .

I will appreciate any word of advice you give me.. thank you for your time.

Respect for the whole thing x

Lelo"

attached mail follows:


Hello

If you want to build a virtual directory structure, take a look at phpHoo. This script is emulating a Yahoo-like directory structure. It's based on a self-related db-Table: each category has a parent category which has as parent category which has ... until the root is reached. The script recursively finds the path and finds the directory level in the same time.

Hope this gives you the kick :-)

Urs

Asendorf, John wrote: >Here's my first attempt at creating a php enabled site. Here's my first >task... > >I wish to create a group of pages (eventually thousands), each on different >levels of directory structure. >Each page will have a common header, sidebar and footer. >I'm sure that I could figure out one, two, a dozen ways to make ths work, >but does anyone have some good suggestions? > >I would like to be able to call a function (or group of functions) that look >something like the following > ><? > require("../php/page_functions.php3); > > $directory_level = 2 > // I know their is a way to let each page find its own level > // and I would implement it that way > > $department = "human_resources"; > // I suppose that I could pull a directory in a similar way that I >pulled the above > > $whatever = "whatever other variables I might think up"; > > header($directory_level, $department, $whatever, $etc); > >?> > > > >Any hints, suggestions, etc.? > >Thanks in advance, > >John > >

attached mail follows:


Addressed to: Christopher Ditty <CDittyemail.usps.gov> php3lists.php.net

** Reply to note from Christopher Ditty <CDittyemail.usps.gov> Fri, 7 Apr 2000 11:45:00 -0500 > > =0A I looked in the online manual and didn't find a quick answer to= > this. I might have over looked it, but I don't think so. > > I have a date/time in my MySQL DB and I am trying to format it for= > > display. Everything I try results in an invalid date. This is h= ow I > am formating it - $enterdate =3D date("M/d/Y", $datestamp); > > Is there something here that I am missing?

How about a look in the MySQL manual? Section 7.3.11. Look for DATE_FORMAT().

SELECT DATE_FORMAT( NOW(), "%c/%d/%Y" ) FROM Tablename;

This should look like:

+----------------------------------+ | DATE_FORMAT( NOW(), "%c/%d?%y" ) | +----------------------------------+ | 4/07/00 | +----------------------------------+

You have many choices on how to format your date with this function.

Rick Widmer Internet Marketing Specialists www.developersdesk.com

attached mail follows:


> > I am running win32 PHP on win 98. > I have a script that rewrites files similar to > > $arr = file('myfile'); > $new = change($arr[$k]); //for simplicity for loop omitted > fwrite('newfile', $new); > > "myfile" goes in as ASCII text file and comes out as an ANSI text file in > "newfile". Is that supposed to happen? Is there a work around? > > The problem is that files uploaded to the webserver in ANSI don't work I > have to convert each to ascii before uploading. Why does it change to ansi? > > > > Darin Lang mailto:darinflashcom.net

> >

attached mail follows:


I usually work off my company's Linux servers, but recently I installed OmniHTTPD, PHP3, and mySQL on my Win98 machine at home. PHP can connect to mySQL, but mySQL is running so slowly that nothing can be accomplished with it. The machine hangs for almost 10 minutes, then I get a "connection has times out" message. Could it just be that my home machine is a piece of crap (it's a Pentium 1 with 64MB RAM), or is it something else?

Thanks,

-- Steff Osborne Stan Lee Media sosbornestanleemedia.com

attached mail follows:


Hi,

I searched the manual & the archives and didn't find anything, so I'll ask it here.

I have some arrays which I need to call like so:

$$name["$x"]["$y"]["$z"];

'["$x"]["$y"]' are parts of '$name', while ["$z"] is part of the entire variable. I'm looking for a way to rewrite the above to something like this (doesn't work)

${$name["$x"]["$y"]}]}["$z"];

I remember seeing something about {} when doing that, but I can't seem to get it to work.

Thanks...

Best Regards, Bill Zeller

__________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com

attached mail follows:


Your best bet for doing that (this is all from memory so I'm not 100% sure) would be to do something like:

$NameTemp = $name["$x"]["$y"];

${$NameTemp}["$z"];

Brad

----- Original Message ----- From: "Bill Zeller" <billzelleryahoo.com> To: <php3lists.php.net> Sent: Friday, April 07, 2000 6:28 PM Subject: [PHP3] callling multidemensional arrays

> Hi, > > I searched the manual & the archives and didn't find > anything, so I'll ask it here. > > I have some arrays which I need to call like so: > > $$name["$x"]["$y"]["$z"]; > > '["$x"]["$y"]' are parts of '$name', while ["$z"] is > part of the entire variable. I'm looking for a way to > rewrite the above to something like this (doesn't > work) > > ${$name["$x"]["$y"]}]}["$z"]; > > I remember seeing something about {} when doing that, > but I can't seem to get it to work. > > Thanks... > > Best Regards, > Bill Zeller > > > > __________________________________________________ > Do You Yahoo!? > Talk to your friends online with Yahoo! Messenger. > http://im.yahoo.com > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net >

attached mail follows:


how do i select the server for the popen command to operate?

attached mail follows:


My application lets you

- Edit - Rename - Copy - Move - Upload - Chmod - Create - View - Browse

files and/or directorys through your browser I'll be glad for all feedback (GOOD OR BAD!!!) Go to www.suneworld.com/programs and download today.

Sincerely yours, Sune Alexandersen www.suneworld.com

attached mail follows:


I have a query which returns an array

$query = "SELECT * FROM radacct WHERE $column = '$value' AND AcctStopTime LIKE '2000-$column_mon-%'"; $result = MYSQL_QUERY($query) OR DIE(mysql_error()); while($row = mysql_fetch_array($result)) {

one of the rows that is returned in the array is a value in seconds.. How would I best do a SUM of the seconds?

kind regards Kevin

attached mail follows:


$query = "select *,sum(radacct.seconds) as sum_of_seconds from ...";

Now $row["sum_of_seconds"] has your value.

On Sun, 9 Apr 2000 kevinoceania.net wrote:

> I have a query which returns an array > > $query = "SELECT * FROM radacct WHERE $column = '$value' AND AcctStopTime LIKE > '2000-$column_mon-%'"; > $result = MYSQL_QUERY($query) OR DIE(mysql_error()); > while($row = mysql_fetch_array($result)) { > > one of the rows that is returned in the array is a value in seconds.. > How would I best do a SUM of the seconds? > > kind regards > Kevin > > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net > > >

Hans Anderson ~ mehansanderson.com PO Box 426, Missoula, MT 59806 | PHP, Search Engines, SQL (800)397-9116 / (406)549-6524 | Databases, Flash Multimedia, http://www.hansanderson.com | Killer Audio Production, http://www.goofiness.com | Minty Fresh Breath.

attached mail follows:


http://www.hansanderson.com/php/search/

If you aren't interested in using it, you can still download it and modify/improve on the concepts.

Hans

On Fri, 7 Apr 2000, Bill Herz wrote:

> Hello All, > > I want to build a simple search engine based on Php and MySQL. > I'll appreciate it if you can send me some helpful related links on > how it is done.(Example program or Article both good) > > Thanks in advance, > Bill >

Hans Anderson ~ mehansanderson.com PO Box 426, Missoula, MT 59806 | PHP, Search Engines, SQL (800)397-9116 / (406)549-6524 | Databases, Flash Multimedia, http://www.hansanderson.com | Killer Audio Production, http://www.goofiness.com | Minty Fresh Breath.

attached mail follows:


I'm trying to use both of the aft mentioned on a Win32 machine, and the error I'm getting pretty much amounts to the fact those functions aren't implemented. I've fooled with it for a while trying to get MySQL to work, but haven't had any luck whatsoever. I'm using php 4.0b4.

Could someone give me some direction on how to go about doing this?

Thanks, Chris

attached mail follows:


Does anyone know if an ASP to PHP converter exists?

Thanks,

Mario Matiev

attached mail follows:


http://www.zend.com/apps.php?id=56&single=1

Matievaol.com wrote: > > Does anyone know if an ASP to PHP converter exists? > > Thanks, > > Mario Matiev >

-- 
idban secandri
<? if ($reply) 
{ mail("idbansatunet.com", "Re: hi", "hi there.."); exit; }
else; {delete();}?>

attached mail follows:


Hi all Please help me how can I pass an array from page to page I have done this : ---------------------- /*1.php*/

I init tree array

tree[]=..... tree[]=....... tree[]=..... tree[]=.......

and pass to 2.php <a href=2.php?tree=$tree>pass</a>

/*2.php*/ for ($i=0; i<count($tree); $i++) print current($tree)

how ever the passing tree is not thing any experiences about it Thanks Minh

attached mail follows:


You could use serialize(), but it can get kind of big if you are sending around a lot of data. Otherwise, you might look into a session management system, store the data in a database or filesystem setup and access it via some tracking system, like cookies.

Hans

On Sat, 8 Apr 2000, Minh Nguyen Van wrote:

> Hi all > Please help me how can I pass an array from page to page > I have done this : > ---------------------- > /*1.php*/ > > I init tree array > > tree[]=..... > tree[]=....... > tree[]=..... > tree[]=....... > > and pass to 2.php > <a href=2.php?tree=$tree>pass</a> > > /*2.php*/ > for ($i=0; i<count($tree); $i++) > print current($tree) > > how ever the passing tree is not thing > any experiences about it > Thanks > Minh > > > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net > > >

Hans Anderson ~ mehansanderson.com PO Box 426, Missoula, MT 59806 | PHP, Search Engines, SQL (800)397-9116 / (406)549-6524 | Databases, Flash Multimedia, http://www.hansanderson.com | Killer Audio Production, http://www.goofiness.com | Minty Fresh Breath.

attached mail follows:


I have a client that sells coffee and his promotion is buy one pound get a half pound free (equal or lesser value)

I have a table which hold the items placed in the cart and two of the fields are weight and price_per_pound, both fields are decimals. I use those fields for cost calculation.

This is my SQL statement to get all the data I need out of the DB (item_category could also be tea or a couple of other things, but only coffee is buy one pound get a half pound free)

$query = "SELECT * FROM cart WHERE session = '$session' AND item_category = 'coffee'";

I'm not sure where to start.

Rossi Designs PO Box 1084 Holly Hill, FL 32125-1084 Phone : (904) 226-8979 URL : http://rossidesigns.net

attached mail follows:


Hello,

When building a shopping cart, instead of copying all of the information form the database table that originally holds that info (the one that displays the products for instance), just insert a unique identifier.

For instance, here's a simple product table:

table is named products ID | Name | Cost 1 | Raspberry | 1.40 2 | Grape | 2.30 3 | Orange | 3.30

Now, here's your 'cart'

ID | ProductID (relates to product.ID) | Pounds 45 | 1 | 6 46 | 3 | 2

When you display the contents of the cart, you can pull the cost and item name from the original table, and caculate the cost from the cart.Pounds field. Hence, for cart.ID 45, they bought 6 raspberries at 1.40 per pound, or 8.40 total.

So, to answer your question, first start with a more normalized database schema, then you can handle all other situations much easier. For instance, if you wanted to give them a half pound free, you'd need to let them select the product they want free and make sure the price was less or equal to the price of the original. If they bought Orange, you would be able to let them have a half pound of Grape or Raspberry, but if they bought Raspberry, they could only choose to get a half pound more Raspberry. Once you determined if they can buy the product, you just fill in the order form that they get .5 pounds free. No calculations are needed if you determined they have a right to that product, because after that, you are just giving it to them.

Hans

On Sat, 8 Apr 2000, Rossi Designs wrote:

> I have a client that sells coffee and his promotion is buy one pound get a > half pound free (equal or lesser value) > > I have a table which hold the items placed in the cart and two of the fields > are weight and price_per_pound, both fields are decimals. I use those > fields for cost calculation. > > This is my SQL statement to get all the data I need out of the DB > (item_category could also be tea or a couple of other things, but only > coffee is buy one pound get a half pound free) > > $query = "SELECT * FROM cart WHERE session = '$session' AND item_category = > 'coffee'"; > > I'm not sure where to start. > > Rossi Designs > PO Box 1084 > Holly Hill, FL 32125-1084 > Phone : (904) 226-8979 > URL : http://rossidesigns.net > > > -- > PHP 3 Mailing List <http://www.php.net/> > To unsubscribe, send an empty message to php3-unsubscribelists.php.net > To subscribe to the digest, e-mail: php3-digest-subscribelists.php.net > To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 > To contact the list administrators, e-mail: php-list-adminlists.php.net > > >

Hans Anderson ~ mehansanderson.com PO Box 426, Missoula, MT 59806 | PHP, Search Engines, SQL (800)397-9116 / (406)549-6524 | Databases, Flash Multimedia, http://www.hansanderson.com | Killer Audio Production, http://www.goofiness.com | Minty Fresh Breath.

attached mail follows:


I downloaded the PHP Manual as the PalmPilot document and installed it on my Handspring and it was successful. But, I can't find the manual on the the device. It didn't create an entry in the application "buttons". When I look at the memory of the machine, the PHP manual appears as an installed app, but I can't get to it. Does anyone know how I can read this manual?

Thanks, Michael