php-general Digest 8 Apr 2001 00:43:26 -0000 Issue 614

Topics (messages 47558 through 47605):

Re: Extension_dir in php.ini?
        47558 by: Yasuo Ohgaki

possible to get the fully qualified path name for file updloads?
        47559 by: Andre Bajew
        47561 by: Rasmus Lerdorf

Re: text string in a gif
        47560 by: Rasmus Lerdorf

How to change useragent-ID sent by PHP4.0.5RC1
        47562 by: Markus Wagner

Re: equivalent of asp's <%= strTest %>
        47563 by: Alexander Skwar
        47564 by: shaun
        47565 by: Philip Olson
        47569 by: Michael Kimsal
        47571 by: Philip Olson

lowest number in field
        47566 by: george
        47567 by: Joe Stump
        47568 by: B. van Ouwerkerk

DESPERADED HELP NEEDED, PLEASE PLEASE PLEASE
        47570 by: Gustavo Vieira Goncalves Coelho Rios

bcc, cc limit on recepients?
        47572 by: Dhaval Desai
        47590 by: Dean Hall
        47594 by: B. van Ouwerkerk

Char Problem
        47573 by: Mon Akira
        47574 by: Jack Dempsey
        47578 by: Jack Dempsey
        47580 by: Philip Olson
        47582 by: Jack Dempsey
        47583 by: Christian Dechery

putting a list of data into 3 columns?
        47575 by: DRN
        47576 by: DRN
        47577 by: Jack Dempsey
        47579 by: Lindsay Adams
        47601 by: DRN

Re: AUTO_INCREMENT with MySQL & phpmyadmin
        47581 by: Lindsay Adams

running as a script
        47584 by: Joseph Bannon
        47585 by: Kurth Bemis

adding methods to classes
        47586 by: Dean Hall
        47600 by: Dean Hall

Re: X509
        47587 by: Dean Hall
        47588 by: Roeland Meyer

PEAR Standards (was Re: equivalent of asp's <%= strTest %>)
        47589 by: Dean Hall
        47591 by: Michael Kimsal
        47592 by: Dean Hall
        47593 by: Michael Kimsal
        47597 by: shaun
        47599 by: Dean Hall

Re: new php.net look
        47595 by: jaxon
        47596 by: jaxon

PHP-Tuxedo Open Source Project
        47598 by: Brian Foddy

Checking the REFERER
        47602 by: Jochen Kaechelin
        47605 by: Dean Hall

html forms, reading & writing data, etc
        47603 by: Andrew V. Romero

Cookie Expire Problem
        47604 by: Jeff Oien

Administrivia:

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

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

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


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


If you are talking about PHP on UNIX, I think the default is

/usr/local/lib/php/extensions/no-debug-non-zts-<version>

For windows, I don't know.

Regards,
--
Yasuo Ohgaki


"Lindsay Adams" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Okay, you may call me an idiot all you want,
> But if the extension_dir= ./
> In php.ini
> And PHP is loaded as an apxs module in apache, then just where does ./ point
> to?
>
> ServerRoot?
> DocumentRoot?
> Some other directory?
>
> Having a major brain **** in getting my .so into the right place.
>
> Also, how can I compile libpdf.so (version 3) to work with PHP4.0.4pl1?
>
> If I have to go backwards in PHP (say to 4.0.3pl1) to be able to get PDF
> support compiled into PHP (because it just isn't working for me on 4.0.4pl1)
> then somebody please tell me that.
>
> I have read through all the suggestions in the list archive
> I have downloaded the latest versions of files pertaining to pdf and
> 4.0.4pl1 from cvs.php.net and yet, I still get the problem, during
> ./configure, of it complaing about my version 3 pdflib, not being version 3
> because it can't find pdf_show_boxed().
>
> I _NEED_ pdf support, so any help in choosing the right set of versions
> would be greatly helpful!
>
> Thanks gang!
>
> Ps- yes, I also changed ext/crypt.c php_srand... On line 150(or thereabouts)
> to make php work at all on my box (Qube2)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Hi,

I'm doing file uploads through PHP and now have a need to retrieve and store
the original fully qualified directory path name used for the upload. For
example if the user copied image file sample.jpg from c:\temp I need to
retrieve and store the c:\temp\ in addition to the sample.jpg that I am
already storing. The directory path does not seem to be availble anywhere.
Is there some way to get this?

TIA!
Andre






> I'm doing file uploads through PHP and now have a need to retrieve and store
> the original fully qualified directory path name used for the upload. For
> example if the user copied image file sample.jpg from c:\temp I need to
> retrieve and store the c:\temp\ in addition to the sample.jpg that I am
> already storing. The directory path does not seem to be availble anywhere.
> Is there some way to get this?

No.  This information is not transferred.

-Rasmus





urldecode($string)

On Sat, 7 Apr 2001, Victor wrote:

> Hello friends,
>
> For those who are not allergic to newbie questions:
>
> I want to make a button for a web page from a background gif and a
> string. Till here nothing unusual. I used the example from the php
> manual and it works like a breeze.
>
> <?php
>     Header("Content-type: image/gif");
>     $string=implode($argv," ");
>     $im = imageCreateFromGif("MyBackground.gif");
>     $color = ImageColorAllocate($im, 196, 51, 28);
>     ImageTTFText ($im, 20, 0, 6, 7, $color, "MyFont.ttf", $string);
>     ImageGif($im);
>     ImageDestroy($im);
> ?>
>
> The only problem I have (and for me it is really biiiiig) is that when
> I  use  a  string  which contains a blank eg "My text" the text of the
> button looks like "My%20TEXT" :-(
>
> How can I fix it??
>
>
> TIA,
> Victor
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Hallo

I am downloading a HTML-File with PHP4.0.5RC1 and I want to change the
useragent-ID from PHP, which will be sent to the webserver where the
HTML-File is.

I am using PHP4.0.5RC1 with NT.

Do you have any ideas ?

-- 
Markus Wagner

     email: [EMAIL PROTECTED]
     Hobby: 747 Jumbo-Jet, Pontiac




So sprach Costas am Wed, Apr 04, 2001 at 02:07:54PM +0100:
> Is there an equivalent in PHP of the following code:
> 
> equivalent of asp's <%= strTest %>

Uhm - what does this strange line do??

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:       http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die guenstige Art an Linux Distributionen zu kommen
                Uptime: 3 days 20 hours 46 minutes





I haven't done asp in a while so if this just shows the var's value then you 
just replace % with ?

<?= $hi ?>

On Saturday 07 April 2001 11:00, Alexander Skwar wrote:
> So sprach Costas am Wed, Apr 04, 2001 at 02:07:54PM +0100:
> > Is there an equivalent in PHP of the following code:
> >
> > equivalent of asp's <%= strTest %>
>
> Uhm - what does this strange line do??
>
> Alexander Skwar





PHP does have an equivelent, as shown by Shaun :

  <?=$var?>

Things to keep in mind :

  1. Is PHP4+ specific
  2. Won't work if short_open_tag setting is off (in php.ini)
     - One reason to turn this off, to enable XML support
  3. Doesn't follow up-and-coming PEAR coding standards

And as you've seen, many don't even know what <?= is.  You'll find zealots
on both sides of this use, the choice is yours. ;-)

Regards,
Philip


On Sun, 8 Apr 2001, shaun wrote:

> 
> I haven't done asp in a while so if this just shows the var's value then you 
> just replace % with ?
> 
> <?= $hi ?>
> 
> On Saturday 07 April 2001 11:00, Alexander Skwar wrote:
> > So sprach Costas am Wed, Apr 04, 2001 at 02:07:54PM +0100:
> > > Is there an equivalent in PHP of the following code:
> > >
> > > equivalent of asp's <%= strTest %>
> >
> > Uhm - what does this strange line do??
> >
> > Alexander Skwar
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





Yes yes I'm a zealot.  :)

If the people defining the PEAR standards really were that interested in
standards,
why include alternate ways of doing something?  <?=$blah;?>
And if the 'short tag' method is useful enough for people, why 'exclude' it
from a standard?  This notion of 'PEAR standards' does irk me some, because
it's been so long in coming, and people are deferring to it before it's a reality.

At least, that's the impression that I get.



Philip Olson wrote:

>
>   1. Is PHP4+ specific
>   2. Won't work if short_open_tag setting is off (in php.ini)
>      - One reason to turn this off, to enable XML support
>   3. Doesn't follow up-and-coming PEAR coding standards
>
> And as you've seen, many don't even know what <?= is.  You'll find zealots
> on both sides of this use, the choice is yours. ;-)





Have a look here :

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

Regarding <?= : the PEAR example was just part of it as it relates to 
short_tags, not <?= specifically.

  http://www.php.net/manual/en/configuration.php#ini.short-open-tag

Regards,
Philip


On Sat, 7 Apr 2001, Michael Kimsal wrote:

> Yes yes I'm a zealot.  :)
> 
> If the people defining the PEAR standards really were that interested in
> standards,
> why include alternate ways of doing something?  <?=$blah;?>
> And if the 'short tag' method is useful enough for people, why 'exclude' it
> from a standard?  This notion of 'PEAR standards' does irk me some, because
> it's been so long in coming, and people are deferring to it before it's a reality.
> 
> At least, that's the impression that I get.
> 
> 
> 
> Philip Olson wrote:
> 
> >
> >   1. Is PHP4+ specific
> >   2. Won't work if short_open_tag setting is off (in php.ini)
> >      - One reason to turn this off, to enable XML support
> >   3. Doesn't follow up-and-coming PEAR coding standards
> >
> > And as you've seen, many don't even know what <?= is.  You'll find zealots
> > on both sides of this use, the choice is yours. ;-)
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 






     Is it possible to be able to query the DB find the lowest numebr in the
table and then display it on the page.


TIA
George






SELECT * FROM table ORDER BY number LIMIT 1

--Joe

On Sat, Apr 07, 2001 at 05:36:04PM +0100, george wrote:
> 
>      Is it possible to be able to query the DB find the lowest numebr in the
> table and then display it on the page.
> 
> 
> TIA
> George
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


/******************************************************************************\
 *                    Joe Stump - PHP/SQL/HTML Developer                      *
 * http://www.care2.com - http://www.miester.org - http://gtk.php-coder.net   *
 * "Better to double your money on mediocrity than lose it all on a dream."   * 
\******************************************************************************/




At 17:36 7-4-01 +0100, george wrote:

>      Is it possible to be able to query the DB find the lowest numebr in the
>table and then display it on the page.

Yup,

Query, sort ASC limit 1 and display it.. should do the job..

Bye,


B.





Hi folks!

have anyone already used FastTemplate over php4 (with the necessary
patches applied) ?

I am facing error when using dymanic macros, have anyone experienced any
problem ?

Thanks a lot for your help!




Hi!


Is there any limit on the number of recepients that a
bcc or a cc field email can be sent to?

I have a loop which extracts arounf 400 emails from
the database and then sends it as email to all the 400
recepients but the script fails and I get a mysql
error.

SO is there any limit on the number of recepients?


Thank you
Dhaval Desai

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/




"Dhaval Desai" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi!
>
>
> Is there any limit on the number of recepients that a
> bcc or a cc field email can be sent to?
>
> I have a loop which extracts arounf 400 emails from
> the database and then sends it as email to all the 400
> recepients but the script fails and I get a mysql
> error.

If your getting a mysql error, is your script failing before you even send
the mail?

Dean Hall.
http://hall.apt7.com







>Is there any limit on the number of recepients that a
>bcc or a cc field email can be sent to?
>
>I have a loop which extracts arounf 400 emails from
>the database and then sends it as email to all the 400
>recepients but the script fails and I get a mysql
>error.
>
>SO is there any limit on the number of recepients?

Hear things like this before.. could be a timeout.. like the maximum time a 
script may run..

Could very well be a maximum on recipients too..

If you do such things on a regular basis you might want to use a 
mailinglist manager.. These things handle bounces all by theirselves

Bye,

B.





Hello... I have a problem with some special chars.... I created some kind of
editor for text files.... but chars like " get a \ in front everytime you
send it.... here is my code:

<form action="self.html" enctype="text/plain">
<textarea name="text" cols="80" rows="15" wrap=off>
<?=$text?>
</textarea><br>
<INPUT TYPE="submit" VALUE="Send">
</form>

If you just enter " and click send you see what my problem is.... does
someone have a idea how to fix this???
Thanks!






look in your php.ini for the setting of magic_quotes
if on, then php will automatically escape quotes for you once you've
submitted data...you can turn it off, and then addslashes right before you
enter your info into a database, or leave it on and stripslashes where
appropriate.....

-jack

-----Original Message-----
From: Mon Akira [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 07, 2001 2:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Char Problem


Hello... I have a problem with some special chars.... I created some kind of
editor for text files.... but chars like " get a \ in front everytime you
send it.... here is my code:

<form action="self.html" enctype="text/plain">
<textarea name="text" cols="80" rows="15" wrap=off>
<?=$text?>
</textarea><br>
<INPUT TYPE="submit" VALUE="Send">
</form>

If you just enter " and click send you see what my problem is.... does
someone have a idea how to fix this???
Thanks!



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






look here
http://www.php.net/manual/en/function.set-magic-quotes-runtime.php

-jack

-----Original Message-----
From: Mon Akira [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 07, 2001 3:03 PM
To: "Jack Dempsey"
Subject: Re: [PHP] Char Problem


On my server I cant change anything on the php.ini.... is there any way how
to solve this problem in the code?

----- Original Message -----
From: ""Jack Dempsey"" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Saturday, April 07, 2001 8:48 PM
Subject: RE: [PHP] Char Problem


> look in your php.ini for the setting of magic_quotes
> if on, then php will automatically escape quotes for you once you've
> submitted data...you can turn it off, and then addslashes right before you
> enter your info into a database, or leave it on and stripslashes where
> appropriate.....
>
> -jack
>
> -----Original Message-----
> From: Mon Akira [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, April 07, 2001 2:45 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Char Problem
>
>
> Hello... I have a problem with some special chars.... I created some kind
of
> editor for text files.... but chars like " get a \ in front everytime you
> send it.... here is my code:
>
> <form action="self.html" enctype="text/plain">
> <textarea name="text" cols="80" rows="15" wrap=off>
> <?=$text?>
> </textarea><br>
> <INPUT TYPE="submit" VALUE="Send">
> </form>
>
> If you just enter " and click send you see what my problem is.... does
> someone have a idea how to fix this???
> Thanks!
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






> On my server I cant change anything on the php.ini.... is there any way how
> to solve this problem in the code?

No.  This setting cannot be set within the script but can be with .htaccess
with the following :

  php_flag magic_quotes_gpc off

And be sure to have a look here (see user comments too) :

  http://www.php.net/manual/en/function.get-magic-quotes-gpc.php
  http://www.php.net/manual/en/configuration.php#ini.magic-quotes-gpc

But, if you just want to strip the slashes before display it's common
to use the stripslashes function :

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

Which means in your case you can do :

  <?php echo stripslashes($text) ?>

It'll print $text as desired. magic_quotes are on by default and are
pretty common and useful, like for putting the data into the database (as
it escapes \"stuff\" automagically!)

Regards,
Philip

> 
> ----- Original Message -----
> From: ""Jack Dempsey"" <[EMAIL PROTECTED]>
> Newsgroups: php.general
> Sent: Saturday, April 07, 2001 8:48 PM
> Subject: RE: [PHP] Char Problem
> 
> 
> > look in your php.ini for the setting of magic_quotes
> > if on, then php will automatically escape quotes for you once you've
> > submitted data...you can turn it off, and then addslashes right before you
> > enter your info into a database, or leave it on and stripslashes where
> > appropriate.....
> >
> > -jack
> >
> > -----Original Message-----
> > From: Mon Akira [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, April 07, 2001 2:45 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Char Problem
> >
> >
> > Hello... I have a problem with some special chars.... I created some kind
> of
> > editor for text files.... but chars like " get a \ in front everytime you
> > send it.... here is my code:
> >
> > <form action="self.html" enctype="text/plain">
> > <textarea name="text" cols="80" rows="15" wrap=off>
> > <?=$text?>
> > </textarea><br>
> > <INPUT TYPE="submit" VALUE="Send">
> > </form>
> >
> > If you just enter " and click send you see what my problem is.... does
> > someone have a idea how to fix this???
> > Thanks!
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





are you sure? have you looked here ->
http://www.php.net/manual/en/function.set-magic-quotes-runtime.php
maybe i'm misinterpreting it, but it seems to do just what he wants.......

-jack


-----Original Message-----
From: Philip Olson [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 07, 2001 3:23 PM
To: Mon Akira
Cc: Jack Dempsey; PHP General List
Subject: RE: [PHP] Char Problem


> On my server I cant change anything on the php.ini.... is there any way
how
> to solve this problem in the code?

No.  This setting cannot be set within the script but can be with .htaccess
with the following :

  php_flag magic_quotes_gpc off

And be sure to have a look here (see user comments too) :

  http://www.php.net/manual/en/function.get-magic-quotes-gpc.php
  http://www.php.net/manual/en/configuration.php#ini.magic-quotes-gpc

But, if you just want to strip the slashes before display it's common
to use the stripslashes function :

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

Which means in your case you can do :

  <?php echo stripslashes($text) ?>

It'll print $text as desired. magic_quotes are on by default and are
pretty common and useful, like for putting the data into the database (as
it escapes \"stuff\" automagically!)

Regards,
Philip

>
> ----- Original Message -----
> From: ""Jack Dempsey"" <[EMAIL PROTECTED]>
> Newsgroups: php.general
> Sent: Saturday, April 07, 2001 8:48 PM
> Subject: RE: [PHP] Char Problem
>
>
> > look in your php.ini for the setting of magic_quotes
> > if on, then php will automatically escape quotes for you once you've
> > submitted data...you can turn it off, and then addslashes right before
you
> > enter your info into a database, or leave it on and stripslashes where
> > appropriate.....
> >
> > -jack
> >
> > -----Original Message-----
> > From: Mon Akira [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, April 07, 2001 2:45 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Char Problem
> >
> >
> > Hello... I have a problem with some special chars.... I created some
kind
> of
> > editor for text files.... but chars like " get a \ in front everytime
you
> > send it.... here is my code:
> >
> > <form action="self.html" enctype="text/plain">
> > <textarea name="text" cols="80" rows="15" wrap=off>
> > <?=$text?>
> > </textarea><br>
> > <INPUT TYPE="submit" VALUE="Send">
> > </form>
> >
> > If you just enter " and click send you see what my problem is.... does
> > someone have a idea how to fix this???
> > Thanks!
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






At 20:45 7/4/2001 +0200, you wrote:
>Hello... I have a problem with some special chars.... I created some kind of
>editor for text files.... but chars like " get a \ in front everytime you
>send it.... here is my code:
>
><form action="self.html" enctype="text/plain">
><textarea name="text" cols="80" rows="15" wrap=off>
><?=$text?>
></textarea><br>
><INPUT TYPE="submit" VALUE="Send">
></form>
>
>If you just enter " and click send you see what my problem is.... does
>someone have a idea how to fix this???
>Thanks!


try stripslashes()...

like this....<textarea ...><?=stripslashes($text)?></textarea>





Hi,
I would like to display a list of products from a MySQL database in 3
columns. as shown below:

Product A      Product D      Product G
Product B      Product E      Product H
Product C      Product F

The problem I have is I don't know how many products there will be, so
I can't just print out the first 3, start new column, print out next
three, start new column, print out rest, end table.

I presume I will have to count the number of results, then use this to
wok out how many have to go in the first column etc.

As I have only recently started using PHP / MySQL I am not sure how
this should be done, has anybody done this (or something similar) so
that I could look at the relevant code.

Many thanks for your help, Donald








Hi,
I would like to display a list of products from a MySQL database in 3
columns. as shown below:

Product A      Product D      Product G
Product B      Product E      Product H
Product C      Product F

The problem I have is I don't know how many products there will be, so
I can't just print out the first 3, start new column, print out next
three, start new column, print out rest, end table.

I presume I will have to count the number of results, then use this to
wok out how many have to go in the first column etc.

As I have only recently started using PHP / MySQL I am not sure how
this should be done, has anybody done this (or something similar) so
that I could look at the relevant code.

Many thanks for your help, Donald








You don't need to count...in your loop you can do something like this: 
if($current_pos%3==0){  //then you're at a multiple of three
        //code to start new column here
}

-jack

-----Original Message-----
From: DRN [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 07, 2001 2:55 PM
To: [EMAIL PROTECTED]
Subject: [PHP] putting a list of data into 3 columns?


Hi,
I would like to display a list of products from a MySQL database in 3
columns. as shown below:

Product A      Product D      Product G
Product B      Product E      Product H
Product C      Product F

The problem I have is I don't know how many products there will be, so
I can't just print out the first 3, start new column, print out next
three, start new column, print out rest, end table.

I presume I will have to count the number of results, then use this to
wok out how many have to go in the first column etc.

As I have only recently started using PHP / MySQL I am not sure how
this should be done, has anybody done this (or something similar) so
that I could look at the relevant code.

Many thanks for your help, Donald





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






Assuming your items are in an array
$items =array() //assume a bunch of items in this array
For($i = 0; $i< (count($items)/3); $i +=1){
    printf("%s\t%s\t%s",$items[$i],$items[$i+3],$items[$i+6]);
}

Should print 3 columns of tab separated text.
Note: typed this quickly, untested, but the theory is sound. Might have to
twiddle the $i<(count... Section.

If you have 8 itesm, as shown and you divide by 3 you get 2.xx
So, the the loop will print out:

$items[0]   $items[3]   $items[6]
$items[1]   $items[4]   $items[7]
$items[2]   $items[5]   $items[8}
// because $items[8] doesn't exist, it won't print.
// if it spits out an error there, put a @in front of printf to turn off
error reporting.


On 4/7/01 11:58 AM, "Jack Dempsey" <[EMAIL PROTECTED]> wrote:

> You don't need to count...in your loop you can do something like this:
> if($current_pos%3==0){    //then you're at a multiple of three
> //code to start new column here
> }
> 
> -jack
> 
> -----Original Message-----
> From: DRN [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, April 07, 2001 2:55 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] putting a list of data into 3 columns?
> 
> 
> Hi,
> I would like to display a list of products from a MySQL database in 3
> columns. as shown below:
> 
> Product A      Product D      Product G
> Product B      Product E      Product H
> Product C      Product F
> 
> The problem I have is I don't know how many products there will be, so
> I can't just print out the first 3, start new column, print out next
> three, start new column, print out rest, end table.
> 
> I presume I will have to count the number of results, then use this to
> wok out how many have to go in the first column etc.
> 
> As I have only recently started using PHP / MySQL I am not sure how
> this should be done, has anybody done this (or something similar) so
> that I could look at the relevant code.
> 
> Many thanks for your help, Donald
> 
> 
> 
> 






Lindsay Adams <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
| Assuming your items are in an array
| $items =array() //assume a bunch of items in this array
| For($i = 0; $i< (count($items)/3); $i +=1){
|     printf("%s\t%s\t%s",$items[$i],$items[$i+3],$items[$i+6]);
| }
|
| Should print 3 columns of tab separated text.
| Note: typed this quickly, untested, but the theory is sound. Might
have to
| twiddle the $i<(count... Section.
|
| If you have 8 itesm, as shown and you divide by 3 you get 2.xx
| So, the the loop will print out:
|
| $items[0]   $items[3]   $items[6]
| $items[1]   $items[4]   $items[7]
| $items[2]   $items[5]   $items[8}
| // because $items[8] doesn't exist, it won't print.
| // if it spits out an error there, put a @in front of printf to turn
off
| error reporting.
|
|
| On 4/7/01 11:58 AM, "Jack Dempsey" <[EMAIL PROTECTED]> wrote:
|
| > You don't need to count...in your loop you can do something like
this:
| > if($current_pos%3==0){    //then you're at a multiple of three
| > //code to start new column here
| > }
| >
| > -jack
| >

Neither of these were quite what I was looking for, I was hoping I
could make a table with 3 <td>'s side by side, each having a third of
the list of products (with <br> between them).
Is this possible? If not I will try to adapt one of these methods.

Cheers for your help, Donald






I don't know why your query isn't working, but why aren't you using
phpMyAdmin's add field section?

Browse the tables definition page, and underneath the column descriptsion,
is a line that says Add new fields [textbox: #][popup:At End of
Database][button: Go]

That brings up a fully functional column add page.

Unless your permissions don't allow you to alter tables? Double check that.

On 4/6/01 10:35 PM, "Plutarck" <[EMAIL PROTECTED]> wrote:

> At first I thought this might be better suited on the mysql list, but since
> I'm using phpmyadmin I thought it better to ask here.
> 
> My problem is I can't figure out how to create a column with the
> auto_increment attribute. I want to make one called userid whose value is
> one higher than the highest number in the userid column, which according to
> the manual is exactly what auto_increment should do.
> 
> But I flat out can't figure out how to do it.
> 
> I'm using the "add new field" attribute in phpmyadmin, and I've tried making
> one with no name and with many different names, and I don't get nuttin'.
> 
> Occassionally it will announce that the table was altered with something
> like the message:
> 
> SQL-query:
> ALTER TABLE test_kingdoms_userauth ADD useridi TINYINT not null
> AUTO_INCREMENT
> 
> But according to the display, no matter how many times I refresh it, there
> is no listing of ANY column other than the two I currently have.
> 
> So I'm totally confused, and out of the whole mysql manual I just don't know
> what's wrong.
> 
> 
> So the question:
> 
> What kind of selections do I need to make to create an AUTO_INCREMENT
> column?
> 
> 
> 
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
> 
> 
> 
> 





How do you get PHP to run at a script, like at a telnet prompt?

J




















At 05:32 PM 4/7/2001, Joseph Bannon wrote:

you must compile php as a CGI executable. :-)  see the man

~kurth

>How do you get PHP to run at a script, like at a telnet prompt?
>
>J
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]





Does PHP allow you to add methods to a class outside the class definition?
This seems not to be straightforward since class prototypes are not allowed.

For instance, what I'm trying to do is add a method to the DB class (in
PEAR) that will do a database query, test if the result is an error/warning,
trigger and error/warning, and (if possible) return the result.

Something like:

DB::ecQuery(&$db, $query) {
    $result = $db->query($query);
    if(DB::isError($result)) {
        triggerError(DB::errorMessage($result), E_USER_ERROR);
    }
    else if(DB::isWarning($result)) {
        triggerError(DB::errorMessage($result), E_USER_WARNING);
    }
    return $result;
}

I can't just add this to my own local copy of PEAR, because my app will be a
public use app, and I'd like my users to have the convenience of using their
preinstalled versions of PEAR (although I've thought of doing something like
BinaryCloud, which includes a distribution of metabase in its distribution).
Also, in case you're wondering, I'm triggering these errors b/c I know my
app will appropriately set PHP error_reporting to a user-defined value.

As it is, I have a "static" class called "Error" with a method called
"dbQuery" that I'm using, but a class called "Error" doesn't seem
appropriate -- "DB" does.

Anybody know if this is possible?

Thanks.
Dean.






Stupid me. Just extend the class.

Now the real question:

Is there any dynamic binding in PHP? Can I override a method in a subclass?

Dean.







Martin.

"Martin Thoma" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I want to write a small script to decrypt/encrypt/sign emails with the
> X509-protocoll.
>
> Does anybody know, where to get information about this protocoll ?

As far as I'm aware, X509 is just a file format for a certificate, not a
protocol. I believe that if you were to support these types of certificates,
you would have to support every encryption/digital signature/MAC algorithm
that X509 does. I think mcrypt should be sufficient for most of those
algorithms.

As for the X509 format itself, check the RFC (I don't know where to find
this -- you should try google.com).

Dean Hall.
http://hall.apt7.com






> From: Dean Hall [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, April 07, 2001 2:57 PM
> 
> Martin.
> 
> "Martin Thoma" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I want to write a small script to decrypt/encrypt/sign 
> emails with the
> > X509-protocoll.
> >
> > Does anybody know, where to get information about this protocoll ?
> 
> As far as I'm aware, X509 is just a file format for a 
> certificate, not a
> protocol. I believe that if you were to support these types 
> of certificates,
> you would have to support every encryption/digital 
> signature/MAC algorithm
> that X509 does. I think mcrypt should be sufficient for most of those
> algorithms.
> 
> As for the X509 format itself, check the RFC (I don't know 
> where to find
> this -- you should try google.com).

www.openssl.org




I have some problems with the PEAR "standards", and I'm wondering what
others have to say about what the PHP developers are doing to overcome PHP's
obvious shortcomings.

<bitch>
<moan>
It seems that one obvious improvement to be made to PHP would be the
implementation of real namespaces. It seems pretty simple to implement this
and stay backwards compatible with PHP3/4. Does anyone know if plans are in
the work for this?

The PEAR standards try to make up for the lack of namespaces . . . and I
suppose its the best that can be done, but it's simply awful! It not only
proposes a standard, it proposes to mandate naming conventions and coding
style as well!

I think the PHP developers should look to the example that Perl has set for
graceful, non-obtrusive namespaces that don't enforce coding style or naming
conventions for classes. (I mean, I don't have to name a subclass of "DB"
"DB_mysql" -- it can be "DB::Mysql".)
</moan>
</bitch>

"Michael Kimsal" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

> If the people defining the PEAR standards really were that interested in
> standards, why include alternate ways of doing something?  <?=$blah;?>
> And if the 'short tag' method is useful enough for people, why 'exclude'
it
> from a standard?  This notion of 'PEAR standards' does irk me some,
because
> it's been so long in coming, and people are deferring to it before it's a
reality.

First of all, I think that the PEAR folk are on a different endeavor than
the PHP developers. The PEAR people seem to be trying to propose a good
standard for a language that needs some improvement. They're doing a decent
job, but I think PEAR should wait till PHP matures a bit.

Second, there is one very good reason not to use short tags: XML. All the
same, I'd rather just enable ASP tags than do away with short tags, as short
tags are irreplacable in templates rich in content and sparse on code.

My $0.02.

Dean Hall.
http://hall.apt7.com







> 
> > If the people defining the PEAR standards really were that interested in
> > standards, why include alternate ways of doing something?  <?=$blah;?>
> > And if the 'short tag' method is useful enough for people, why 'exclude'
> it
> > from a standard?  This notion of 'PEAR standards' does irk me some,
> because
> > it's been so long in coming, and people are deferring to it before it's a
> reality.
> 
> First of all, I think that the PEAR folk are on a different endeavor than
> the PHP developers. The PEAR people seem to be trying to propose a good
> standard for a language that needs some improvement. They're doing a decent
> job, but I think PEAR should wait till PHP matures a bit.
> 
> Second, there is one very good reason not to use short tags: XML. All the
> same, I'd rather just enable ASP tags than do away with short tags, as short
> tags are irreplacable in templates rich in content and sparse on code.
> 

I'm not sure why XML is an issue.  Does XML use the ? in it's syntax?  XML
tags are, to my knowledge, of the <blah><blah/> style.  Am I missing
something?  I admit it's been a bit since I've gotten into dealing with
XML at any real in-depth level, but the short tags in PHP don't seem like
they'd be a problem.  If they're a problem for PHP, I think a lot of ASP
shops will be caught short when dealing with XML.







"Michael Kimsal" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm not sure why XML is an issue.  Does XML use the ? in it's syntax?  XML
> tags are, to my knowledge, of the <blah><blah/> style.  Am I missing
> something?  I admit it's been a bit since I've gotten into dealing with
> XML at any real in-depth level, but the short tags in PHP don't seem like
> they'd be a problem.  If they're a problem for PHP, I think a lot of ASP
> shops will be caught short when dealing with XML.

<?xml version="1.0"?>

This is the first line of an XML file. Including XML files from PHP scripts
will be a real problem if short tags are enabled.

Dean Hall.
http://hall.apt7.com








On Sat, 7 Apr 2001, Dean Hall wrote:

> "Michael Kimsal" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I'm not sure why XML is an issue.  Does XML use the ? in it's syntax?  XML
> > tags are, to my knowledge, of the <blah><blah/> style.  Am I missing
> > something?  I admit it's been a bit since I've gotten into dealing with
> > XML at any real in-depth level, but the short tags in PHP don't seem like
> > they'd be a problem.  If they're a problem for PHP, I think a lot of ASP
> > shops will be caught short when dealing with XML.
> 
> <?xml version="1.0"?>
> 
> This is the first line of an XML file. Including XML files from PHP scripts
> will be a real problem if short tags are enabled.
> 
> Dean Hall.
> http://hall.apt7.com

DUH!  :(  Why did those pesky XML people have to do that???  
All of that cool header stuff is stuff I normally skip - like the ISO
charset stuff that WYSIWYG editors are fond of putting at the top of every
file they create.  :)


And oh yeah, I realized my ASP comment mistake about 4 seconds after
hitting send...  

Not a good mailing day for me today!  ;)







I'm pretty sure you can make php use the asp style % though too, not sure if 
that's for short tags, regular tags or both, I know it's in the config 
though, anyone know?

Shaun


On Saturday 07 April 2001 18:46, Michael Kimsal wrote:
> On Sat, 7 Apr 2001, Dean Hall wrote:
> > "Michael Kimsal" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> > > I'm not sure why XML is an issue.  Does XML use the ? in it's syntax? 
> > > XML tags are, to my knowledge, of the <blah><blah/> style.  Am I
> > > missing something?  I admit it's been a bit since I've gotten into
> > > dealing with XML at any real in-depth level, but the short tags in PHP
> > > don't seem like they'd be a problem.  If they're a problem for PHP, I
> > > think a lot of ASP shops will be caught short when dealing with XML.
> >
> > <?xml version="1.0"?>
> >
> > This is the first line of an XML file. Including XML files from PHP
> > scripts will be a real problem if short tags are enabled.
> >
> > Dean Hall.
> > http://hall.apt7.com
>
> DUH!  :(  Why did those pesky XML people have to do that???
> All of that cool header stuff is stuff I normally skip - like the ISO
> charset stuff that WYSIWYG editors are fond of putting at the top of every
> file they create.  :)
>
>
> And oh yeah, I realized my ASP comment mistake about 4 seconds after
> hitting send...
>
> Not a good mailing day for me today!  ;)




(Reply to your TOFU:)

"shaun" <[EMAIL PROTECTED]> wrote in message 01040817181702.01567@box">news:01040817181702.01567@box...
> I'm pretty sure you can make php use the asp style % though too, not sure
if
> that's for short tags, regular tags or both, I know it's in the config
> though, anyone know?
>
> Shaun

Yeah, ASP tags are all short, I believe. There is no long version. (Okay,
I'm not completely sure, but pretty sure.)

Dean.






> The older look was neat to show off to people re: pop up menus, etc.,
> but this is
> a real speed demon, and will be much more useful for searching around.

Speaking of which - there used to be a little HOWTO for doing those kind of
popups - does anyone know where it has gone to?

regards,
jaxon



> 
> Thanks again!
> 
> 





> The older look was neat to show off to people re: pop up menus, etc.,
> but this is
> a real speed demon, and will be much more useful for searching around.

Speaking of which - there used to be a little HOWTO for doing those kind of
popups - does anyone know where it has gone to?

regards,
jaxon



> 
> Thanks again!
> 
> 





Open Source Project Announcement...

I have started an open source project to build a module for 
PHP4 that will allow direct calls to Tuxedo services from 
the PHP script, the project name is php-tuxedo.

Think about it for a second...  The ability from inside a 
PHP web page to directly call already existing Tuxedo 
services anywhere in your environment.  Just like PHP can 
open a database connection to Oracle or Sybase, it would 
open a Tuxedo connection as a Tux client to a Tuxedo 
middleware environment.

For those who have used PHP, you know how easy it is to 
build dynamic web pages.  But those pages are mostly limited 
to database queries or flat file access for data.  With this
project you could call all your existing enterprise Tuxedo
services directly.  I believe this would be a very powerful
enhancement to PHP's capabilities.

To those familiar with Tuxedo, you know about how powerful 
an implementation of Tux middleware services can be for 
departmental and enterprise solutions.

I want to bring these two pieces together.

Project status.  The project is in its early infancy, but 
some parts are functional.  I have successfully built a 
client page that uses a STRING buffer to call a service with 
tpcall and returns a STRING buffer back.  Primitive?  Sure, 
but this is only the start.  I have ideas of how to 
implement many other functions and buffer types including 
FMLs.

There is much work to do, but if you are interested please 
check out http://php-tuxedo.sourceforge.net.  There you can 
download my first cut and more importantly follow the 
project as it progresses.  For the really ambitious I would 
welcome any testing or development help on the project.  
Please note I'm posting this note to several lists I don't 
normally monitor, so I may not see a reply on the list.

Hope to hear from you.
Brian Foddy
[EMAIL PROTECTED]








Waht might be the most secure method to check,
if a certain page was reached by submitting a form
instead of typing the adress directly?

I read, the the $HTTP_REFERER may be changed, e.g. 
when WEBWASHER or other programs are in use!

Pleas help!

Thanx

--
Jochen Kaechelin - Ihr WEBberater
Stuttgarter Str.3, D-73033 Goeppingen
Tel. 07161-92 95 94, Fax 07161-92 95 98
http://www.wa-p.de, mailto:[EMAIL PROTECTED] 





"Jochen Kaechelin" <[EMAIL PROTECTED]> wrote in message
NFBBLHGFAKNLFNPOHMPHOEKLCFAA.jk@intern">news:NFBBLHGFAKNLFNPOHMPHOEKLCFAA.jk@intern...
> Waht might be the most secure method to check,
> if a certain page was reached by submitting a form
> instead of typing the adress directly?

Well, the HTTP_REFERRER is not reliable at all. Some agents (browsers) fill
this up with a bunch of worthless foo, so never depend on it.

The best way I can think of is to have some very secret and persistent key
on the server and hash it (perhaps with another value like the current
timestamp or the filename of the form-processor you want to redirect the
user from) and send the hash (and the other value, if you used one) to the
client as a GET parameter.

The page can then check to see if the hash is good. If it is (and the key is
kept secret), then you know the page was reached by the form-handler.

You can use the built-in md5 for this, but if security is a major concern,
get the mhash extensioin for PHP and use SHA1 or RIPEMD160, as md5 is known
to have weaknesses.

Dean Hall.






First thanks to all the ideas for reading one word from a file, but I
hit another snag.
Here is what I am trying to accomplish.  I have a text file
(questionFile.txt) and it contains questions that can be arranged like:
1.  Question One
A1.  Question OneA
C.  Question Three
For this email, I will call the 1.  A1.  C. all question numbers.
So my first php script reads this file and for each question it creates
a place for a user to enter the answer and each answer input has should
have a name that correspondes to each question number (e.g. 1.  A1. C.
or whatever comes before the period).  So the code that does this is
($wd is the file that contains the questions):
 while(!feof($wd) )
 {
      $question = trim( fgets($wd, 4096) );
      if (strlen($question))
  {
       $questionWordArray = explode(" ", $question);
       $currentQuestionNumber = $questionWordArray[0];
       //$questionNumberArray[$questionCounter]=$currentQuestionNumber;
       echo "$question  <input NAME=\"$currentQuestionNumber\"><br>";
       //echo "<input type=\"hidden\"
name=\"questionNumberArray[$questionCounter]\"
                value=\"$questionNumberArray[$questionCounter]\">";
       $questionCounter++;
      }
 }
Then once the user enters answers to the questions he or she knows, they
hit the submit button and my second script takes that data, writes it to
the answer file and displays all the other answers that people have
entered for these questions.  I was trying to get the answer file to be
written in the following manner:
1.  First person that answers questoin 1
A1.  First person that answers question A1
1.  Second person that answers question 2
C.  first person to answer question C.
Then for displaying the questions and all the answers for that
questions, I was having the second script, print the first question and
then compare the first question's question number to each of the
question numbers in the answer file and if they match then it prints
that answer and continues to search for more answers for that question.
My problem is in writing this answer file.  Since the name of the input
field for the questions is the question Numbers, I don't see how to
differentiate the value contained in $currentQuestionNumber.
$currentQuestionNumber is the name of each of the input fields and it
also should contain the data that the user enters for the answer to the
question.  When I am trying to write the answer file, I am not sure how
to get access to the answer the user put in, when I try to just write
$currentQuestionNumber for each of the questions, it just writes 1.  1.
A1.  A1.
C.  C.
instead of
1.  Answer 1 here
A2.  Answer A2 here
C.  Answer C here.
I was playing around with putting all the $currentQuestionNumber into an
array (as you can see from the commented out section) in hopes that then
I could use those to refer to the actual answer but that didn't work.
So how would you go about doing this?
---Andrew V. Romero
If you want to reply personally, remove all numbers from my address.





This code won't set a cookie. I took the time part from a past
post to set the time for waaaay ahead. I must be doing it wrong
though:

$time = time();
$cookie_name = "auth";
$cookie_value = "ok";
$cookie_expire = "$time*3";
$cookie_domain = "";
setcookie($cookie_name, $cookie_value, $cookie_expire, "/" , $cookie_domain, 0);

Thanks.
Jeff Oien


Reply via email to