php-general Digest 20 Apr 2001 07:51:33 -0000 Issue 638
Topics (messages 49411 through 49530):
Re: Which is better coding style...
49411 by: Steve Lawson
49416 by: Sander Pilon
49417 by: Miles Thompson
49419 by: Mart�n Marqu�s
49424 by: ..s.c.o.t.t.. [gts]
49430 by: Norbert Pfeiffer
49431 by: Philip Olson
49436 by: Chris Adams
49445 by: David Bouw
49460 by: Plutarck
49466 by: Chris Lee
49467 by: Chris Lee
49468 by: Chris Lee
49472 by: Szii
49487 by: Joe Sheble \(Wizaerd\)
ENUM or SET and PHP
49412 by: Jason Caldwell
SQL Select Unique() ?
49413 by: James, Yz
49474 by: David Robley
49479 by: CC Zona
Re: text formatting
49414 by: James, Yz
Re: Site Searchable function
49415 by: Steve Lawson
Re: Starting PHP script with crontab
49418 by: Steve Lawson
49469 by: Chris Lee
Authentication
49420 by: Navid Yar
49421 by: Jack Dempsey
49422 by: Kath
49527 by: Navid Yar
mail() and stripslashes()
49423 by: Isaac Force
49528 by: Navid Yar
submit form values to new site after validation
49425 by: Tom Beidler
49432 by: Phillip Bow
Newbie Technical Question
49426 by: Nashirak Bosk
49454 by: Plutarck
Re: PHP4.0.4pl1+PdfLib3.03+SCO
49427 by: Grimes, Dean
Re: `AM_PROG_LIBTOOL' not found in library
49428 by: Pablo Sabatino
Re: Add data to three tables at once from one form
49429 by: Julian Wood
killing a session
49433 by: Ellis Heckman
49434 by: Phillip Bow
Newbie - treestructure
49435 by: Johan Evers Petersen
Treestructure
49437 by: Johan Evers Petersen
49465 by: Chris Lee
49529 by: Johan Evers Petersen
unsubscribe me
49438 by: Bruno M�rio Amaral Almeida
Advanced Help Needed
49439 by: Marc Davenport
49442 by: Chris Anderson
49444 by: Matt Friedman
49447 by: Szii
PHP and Ranges
49440 by: Jason Caldwell
49458 by: ..s.c.o.t.t..
49462 by: Chris Lee
49463 by: Plutarck
imap
49441 by: Martin Oust
PDFlib 4.0.0.... any experiences..
49443 by: David Bouw
PHP4 4.04pl1 ODBC/Openlink/Progress8.3 COUNT Problem
49446 by: Grant Walters
gd php freetype problem solved
49448 by: Kurth Bemis
Re: HTMLSpecialchars
49449 by: Dddogbruce \(.home.com\)
Re: how to scale down image using ImageMagick?
49450 by: Noah Spitzer-Williams
49456 by: Joe Stump
Last Element in an Array?
49451 by: Jason Caldwell
49452 by: Rasmus Lerdorf
49453 by: Andrew Hill
49461 by: ..s.c.o.t.t..
ClibPDF -- problems with cpdf_rect and cpdf_lineto
49455 by: galkin
Re: image-resize/convert
49457 by: Joe Stump
Re: List Files
49459 by: Joe Stump
Re: image-resize (thumbnail 150x150 code)
49464 by: ..s.c.o.t.t..
Lynx, Cron and PHP
49470 by: Chris Aitken
49471 by: Chris Aitken
49510 by: Tom Rogers
Cache Control with forms
49473 by: Diego Fulgueira
49475 by: Rasmus Lerdorf
more an SQL issue but I can't find any help
49476 by: Marian Vasile
49481 by: David Robley
49526 by: David Robley
Handling Macintosh filenames in PHP
49477 by: Shawn Reed
49485 by: Julian Wood
Newbie question: Page Counter
49478 by: Marthe Kristiansen
49480 by: Maxim Maletsky
49492 by: Adam
49495 by: yanto
49512 by: Marthe Kristiansen
49516 by: Jack Dempsey
Re: SESSIONS, a weird, funny yet strange error happens to w rong people...
49482 by: Maxim Maletsky
How do I detect if mysql_connect failes?
49483 by: Marcus Rasmussen
49484 by: David Robley
49486 by: Marcus Rasmussen
49500 by: Steve Edberg
Output HTML Compression
49488 by: Floyd Piedad
49489 by: Andrew Braund
Use of special characters in filenames results in IE problems
49490 by: Floyd Piedad
Re: HTML and slashes.
49491 by: Floyd Piedad
Regular Expressions?
49493 by: Jason Caldwell
49494 by: elias
49496 by: yanto
49497 by: Brian Clark
49498 by: Jason Caldwell
49501 by: Brian Clark
49502 by: Jason Caldwell
49503 by: Jason Caldwell
49504 by: Jack Dempsey
49506 by: David Robley
49507 by: Jason Caldwell
49508 by: Brian Clark
49509 by: Brian Clark
49517 by: Jason Caldwell
49520 by: Brian Clark
regarding time()
49499 by: reena_aanchal.worldmailer.com
49505 by: David Robley
49525 by: David Robley
Re: Using mogrify ..
49511 by: Mathur
bounces from messages send to this list
49513 by: B. van Ouwerkerk
49519 by: Brian Clark
49523 by: Rasmus Lerdorf
Re: SETUP PHP , MYSQL, APACHE
49514 by: B. van Ouwerkerk
49524 by: Maxim Maletsky
displaying string combinations
49515 by: Ray Iftikhar
49518 by: Jack Dempsey
49521 by: Maxim Maletsky
Zend Optimizer on Solaris8 x86. Help!!
49522 by: Chris
network error
49530 by: claudia
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]
----------------------------------------------------------------------
Personally, I hate trailing {'s
I think this
function blah()
{
switch( $bob )
{
case 1:
$var = "whatever";
break;
}
}
Is much easier to read and follow. As for the exiting question...
The "proper" way is to use the breaks. "They" say that multiple returns in
any function = bad programming. The .0001 second that it takes to break and
return the value will never matter.
Plus, you or someone else may have to add to that function later. Let's say
I wanted to add "</B>" to the end of $retval. If you use the normal way I
can just make one change, return $retval . "</B>"; instead of changing 3
different returns.
SL.
----- Original Message -----
From: "Boget, Chris" <[EMAIL PROTECTED]>
To: "Php (E-mail)" <[EMAIL PROTECTED]>
Sent: Thursday, April 19, 2001 11:57 AM
Subject: [PHP] Which is better coding style...
> Which is better?
>
> function blah() {
> switch( $bob ) {
> case 1:
> return "this";
>
> case 2:
> return "that";
>
> default:
> return "other";
>
> }
> }
>
> function blah() {
> $retval = "";
>
> switch( $bob ) {
> case 1:
> $retval = "this";
> break;
>
> case 2:
> $retval = "that";
> break;
>
> default:
> $retval = "other";
> break;
>
> }
>
> return $retval;
>
> }
>
>
> In other words, is it good practice to exit out of a block (any
> block... not just switch; if, for, while) prematurely as demon-
> strated in the first example? Or should you do it as demon-
> strated in the second example?
>
> Chris
>
Definitely the second style :)
(If we were talking about C(++) then the first would have even been
forbidden by my companies coding standard as well as several coding
standards of other companies I worked for.)
The reason is this - a function has one entrypoint (duh) and one
exitpoint. Jumping out of a function somewhere in the middle leads to
unmaintainable code, and bugs when extending that function and that
return is overlooked. But, as with the indenting and bracket placing, it
is a matter of religion. They would have to torture me for three weeks
to get me to place the brackets like you did in your example :)
function blah()
{
$retval = "";
switch( $bob )
{
case 1:
$retval = "this";
break;
case 2:
$retval = "that";
break;
default:
$retval = "other";
break;
}
return $retval;
}
> -----Original Message-----
> From: ..s.c.o.t.t.. [gts] [mailto:[EMAIL PROTECTED]]
> Sent: 19 April 2001 21:31
> To: Php-General
> Subject: RE: [PHP] Which is better coding style...
>
>
> i say the first style.
>
> unneeded variables and other thingies just
> obscure things and make it harder to maintain.
>
>
> > -----Original Message-----
> > From: Boget, Chris [mailto:[EMAIL PROTECTED]]
> > Subject: [PHP] Which is better coding style...
> >
> > Which is better?
> >
> > function blah() {
> > switch( $bob ) {
> > case 1:
> > return "this";
> >
> > case 2:
> > return "that";
> >
> > default:
> > return "other";
> >
> > }
> > }
> >
>
>
> --
> 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]
>
>
Amen! For both elimination of trailing {'s , and a good clear break.
I don't know how trailing {'s came about, but I find the blocks are harder
to follow. I consider them HIDDEN rather than trailing, but I cut my teeth
on Pascal, and FoxPro. While we're at it, how about plain old carriage
returns to terminate the line and elimination of the ";"?
I still do a fair bit of work in Visual FoxPro, where the semi-colon
indicates line continuation. Some days I introduce strange bugs when
switching from PHP to VFP, and vice versa.
Miles
At 01:48 PM 4/19/01 -0600, Steve Lawson wrote:
>Personally, I hate trailing {'s
>
>I think this
>
>function blah()
>{
> switch( $bob )
> {
> case 1:
> $var = "whatever";
> break;
> }
>}
>
>Is much easier to read and follow. As for the exiting question...
>
>The "proper" way is to use the breaks. "They" say that multiple returns in
>any function = bad programming. The .0001 second that it takes to break and
>return the value will never matter.
>
>Plus, you or someone else may have to add to that function later. Let's say
>I wanted to add "</B>" to the end of $retval. If you use the normal way I
>can just make one change, return $retval . "</B>"; instead of changing 3
>different returns.
>
>SL.
>
>
>
>----- Original Message -----
>From: "Boget, Chris" <[EMAIL PROTECTED]>
>To: "Php (E-mail)" <[EMAIL PROTECTED]>
>Sent: Thursday, April 19, 2001 11:57 AM
>Subject: [PHP] Which is better coding style...
>
>
> > Which is better?
> >
> > function blah() {
> > switch( $bob ) {
> > case 1:
> > return "this";
> >
> > case 2:
> > return "that";
> >
> > default:
> > return "other";
> >
> > }
> > }
> >
> > function blah() {
> > $retval = "";
> >
> > switch( $bob ) {
> > case 1:
> > $retval = "this";
> > break;
> >
> > case 2:
> > $retval = "that";
> > break;
> >
> > default:
> > $retval = "other";
> > break;
> >
> > }
> >
> > return $retval;
> >
> > }
> >
> >
> > In other words, is it good practice to exit out of a block (any
> > block... not just switch; if, for, while) prematurely as demon-
> > strated in the first example? Or should you do it as demon-
> > strated in the second example?
> >
> > Chris
> >
>
>
>--
>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 Jue 19 Abr 2001 23:35, Miles Thompson wrote:
> Amen! For both elimination of trailing {'s , and a good clear break.
>
> I don't know how trailing {'s came about, but I find the blocks are harder
> to follow. I consider them HIDDEN rather than trailing, but I cut my teeth
> on Pascal, and FoxPro. While we're at it, how about plain old carriage
> returns to terminate the line and elimination of the ";"?
>
> I still do a fair bit of work in Visual FoxPro, where the semi-colon
> indicates line continuation. Some days I introduce strange bugs when
> switching from PHP to VFP, and vice versa.
Well, first I would have to say tat there are a lot of other (better)
languages then Visual FoxPro out there!!!
Check C, C++ sintax.
And to finish, I think Visual FoxPro should change there definition of the
";".
Saludos... :-)
--
El mejor sistema operativo es aquel que te da de comer.
Cuida tu dieta.
-----------------------------------------------------------------
Martin Marques | [EMAIL PROTECTED]
Programador, Administrador | Centro de Telematica
Universidad Nacional
del Litoral
-----------------------------------------------------------------
OOooo...
it drives me nuts when i see beginning brackets
on seperate lines ;)
i like to start brackets on the same line as the
statement and finish them on a line of their own.
if (...) {
}
else {
}
(it drives me nuts to see "} else {" also)
> -----Original Message-----
> From: Sander Pilon [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 19, 2001 4:32 PM
> To: 'Php-General'
> Subject: RE: [PHP] Which is better coding style...
>
>
> Definitely the second style :)
>
> (If we were talking about C(++) then the first would have even been
> forbidden by my companies coding standard as well as several coding
> standards of other companies I worked for.)
>
> The reason is this - a function has one entrypoint (duh) and one
> exitpoint. Jumping out of a function somewhere in the middle leads to
> unmaintainable code, and bugs when extending that function and that
> return is overlooked. But, as with the indenting and bracket placing, it
> is a matter of religion. They would have to torture me for three weeks
> to get me to place the brackets like you did in your example :)
>
>
> function blah()
> {
> $retval = "";
>
> switch( $bob )
> {
> case 1:
> $retval = "this";
> break;
>
> case 2:
> $retval = "that";
> break;
>
> default:
> $retval = "other";
> break;
> }
>
> return $retval;
> }
>
> > -----Original Message-----
> > From: ..s.c.o.t.t.. [gts] [mailto:[EMAIL PROTECTED]]
> > Sent: 19 April 2001 21:31
> > To: Php-General
> > Subject: RE: [PHP] Which is better coding style...
> >
> >
> > i say the first style.
> >
> > unneeded variables and other thingies just
> > obscure things and make it harder to maintain.
> >
> >
> > > -----Original Message-----
> > > From: Boget, Chris [mailto:[EMAIL PROTECTED]]
> > > Subject: [PHP] Which is better coding style...
> > >
> > > Which is better?
> > >
> > > function blah() {
> > > switch( $bob ) {
> > > case 1:
> > > return "this";
> > >
> > > case 2:
> > > return "that";
> > >
> > > default:
> > > return "other";
> > >
> > > }
> > > }
> > >
> >
> >
> > --
> > 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]
>
Hi,
This participates the clearest for me,
but unfortunately not usual.
if (...)
{...commands...
switch(...)
{case commands...
case commands...
case commands...
}
while(...)
{...commands...
}
}
else
{...commands...
}
it participates maybe uncomfortable to write,
however, simply to debug...
I learning be doing,
but this already many years... ;-)
m.f.G. N. Pfeiffer
_______________________________
www.uris.de [EMAIL PROTECTED]
0177-2363368 02292-681769
-------------------------------
e.o.m.
coding style? here's what pear has to say :
http://www.php.net/manual/en/pear.standards.php
http://www.php.net/manual/en/pear.standards.control.php
[ example ]
switch (condition) {
case 1:
action1;
break;
case 2:
action2;
break;
default:
defaultaction;
break;
}
[ /example ]
variables can be very useful.
return is cool too.
:)
regards,
philip
On 19 Apr 2001 14:08:13 -0700, ..s.c.o.t.t.. [gts] <[EMAIL PROTECTED]>
wrote:
>OOooo...
>
>it drives me nuts when i see beginning brackets
>on seperate lines ;)
>
>i like to start brackets on the same line as the
>statement and finish them on a line of their own.
Very strong agreement here. I think a lot of it depends on your environment.
Some have syntax highlighting and, better yet, syntax highlighting which will
prominently mark unbalanced braces, brackets, etc. Also very nice are things
like a brace-matching hotkey or options to highlight the matching open
character when you close it. If you have all of these tools to help show
syntax, I don't think you need as help from the source formatting. (The only
times I've liked having them on separate lines is when I've been working with
an editor which lacks this)
It also helps to properly indent things. I think code like this makes it pretty
easy to see which code is in which block:
if () {
...
if () {
if () {
// Do something
} else {
// Do something else
}
}
} else {
...
}
This is one thing I've always liked about Python. Forcing people to indent
consistently is a little harsh but it does have the advantage of making strange
code easier to decipher.
>(it drives me nuts to see "} else {" also)
Here, I have to differ - using anything else makes me itch.
--
"Any sufficiently accurate worldview is indistinguishable from cynicism"
Your coding style is not the most used..
But I must be honest and tell you that I also find the clearest way...
I also use it on all my own code.. It has got the advantage that you always
see all brackets (no need to scroll to the right to find a bracket) and if
you go down on the same horizontal position you should always find a
bracket closing your statement...
> This participates the clearest for me,
> but unfortunately not usual.
>
> if (...)
> {...commands...
> switch(...)
> {case commands...
> case commands...
> case commands...
> }
> while(...)
> {...commands...
> }
> }
> else
> {...commands...
> }
>
> it participates maybe uncomfortable to write,
> however, simply to debug...
>
> I learning be doing,
> but this already many years... ;-)
>
>
> m.f.G. N. Pfeiffer
> _______________________________
> www.uris.de [EMAIL PROTECTED]
> 0177-2363368 02292-681769
> -------------------------------
> e.o.m.
>
>
> --
> 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]
>
>
Personally I use to use:
if () {
...
}
But I found it utterly horrible to debug. I always missed a bracket, so I
switch to:
if ()
{
...
}
I find that even in multi-thousand line files I can flick my scroll mouse as
fast as I can while still being able to follow brackets using that style.
I just think it's easier to follow and clearer, but I understand why some
people don't like them. I use to hate them...until I started using them :}
--
Plutarck
Should be working on something...
...but forgot what it was.
""..s.c.o.t.t.. [gts]"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> OOooo...
>
> it drives me nuts when i see beginning brackets
> on seperate lines ;)
>
> i like to start brackets on the same line as the
> statement and finish them on a line of their own.
>
> if (...) {
> }
> else {
> }
>
> (it drives me nuts to see "} else {" also)
>
>
> > -----Original Message-----
> > From: Sander Pilon [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, April 19, 2001 4:32 PM
> > To: 'Php-General'
> > Subject: RE: [PHP] Which is better coding style...
> >
> >
> > Definitely the second style :)
> >
> > (If we were talking about C(++) then the first would have even been
> > forbidden by my companies coding standard as well as several coding
> > standards of other companies I worked for.)
> >
> > The reason is this - a function has one entrypoint (duh) and one
> > exitpoint. Jumping out of a function somewhere in the middle leads to
> > unmaintainable code, and bugs when extending that function and that
> > return is overlooked. But, as with the indenting and bracket placing, it
> > is a matter of religion. They would have to torture me for three weeks
> > to get me to place the brackets like you did in your example :)
> >
> >
> > function blah()
> > {
> > $retval = "";
> >
> > switch( $bob )
> > {
> > case 1:
> > $retval = "this";
> > break;
> >
> > case 2:
> > $retval = "that";
> > break;
> >
> > default:
> > $retval = "other";
> > break;
> > }
> >
> > return $retval;
> > }
> >
> > > -----Original Message-----
> > > From: ..s.c.o.t.t.. [gts] [mailto:[EMAIL PROTECTED]]
> > > Sent: 19 April 2001 21:31
> > > To: Php-General
> > > Subject: RE: [PHP] Which is better coding style...
> > >
> > >
> > > i say the first style.
> > >
> > > unneeded variables and other thingies just
> > > obscure things and make it harder to maintain.
> > >
> > >
> > > > -----Original Message-----
> > > > From: Boget, Chris [mailto:[EMAIL PROTECTED]]
> > > > Subject: [PHP] Which is better coding style...
> > > >
> > > > Which is better?
> > > >
> > > > function blah() {
> > > > switch( $bob ) {
> > > > case 1:
> > > > return "this";
> > > >
> > > > case 2:
> > > > return "that";
> > > >
> > > > default:
> > > > return "other";
> > > >
> > > > }
> > > > }
> > > >
> > >
> > >
> > > --
> > > 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]
>
I preffer the first.
--
Chris Lee
[EMAIL PROTECTED]
""Boget, Chris"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Which is better?
function blah() {
switch( $bob ) {
case 1:
return "this";
case 2:
return "that";
default:
return "other";
}
}
function blah() {
$retval = "";
switch( $bob ) {
case 1:
$retval = "this";
break;
case 2:
$retval = "that";
break;
default:
$retval = "other";
break;
}
return $retval;
}
In other words, is it good practice to exit out of a block (any
block... not just switch; if, for, while) prematurely as demon-
strated in the first example? Or should you do it as demon-
strated in the second example?
Chris
I agree with your bracket style not your return policy. oh well :)
if ($true)
{
// do something
} else
{
// do something else
}
--
Chris Lee
[EMAIL PROTECTED]
""Sander Pilon"" <[EMAIL PROTECTED]> wrote in message
008d01c0c90f$c712bbc0$ce6278d4@cc6755b">news:008d01c0c90f$c712bbc0$ce6278d4@cc6755b...
Definitely the second style :)
(If we were talking about C(++) then the first would have even been
forbidden by my companies coding standard as well as several coding
standards of other companies I worked for.)
The reason is this - a function has one entrypoint (duh) and one
exitpoint. Jumping out of a function somewhere in the middle leads to
unmaintainable code, and bugs when extending that function and that
return is overlooked. But, as with the indenting and bracket placing, it
is a matter of religion. They would have to torture me for three weeks
to get me to place the brackets like you did in your example :)
function blah()
{
$retval = "";
switch( $bob )
{
case 1:
$retval = "this";
break;
case 2:
$retval = "that";
break;
default:
$retval = "other";
break;
}
return $retval;
}
> -----Original Message-----
> From: ..s.c.o.t.t.. [gts] [mailto:[EMAIL PROTECTED]]
> Sent: 19 April 2001 21:31
> To: Php-General
> Subject: RE: [PHP] Which is better coding style...
>
>
> i say the first style.
>
> unneeded variables and other thingies just
> obscure things and make it harder to maintain.
>
>
> > -----Original Message-----
> > From: Boget, Chris [mailto:[EMAIL PROTECTED]]
> > Subject: [PHP] Which is better coding style...
> >
> > Which is better?
> >
> > function blah() {
> > switch( $bob ) {
> > case 1:
> > return "this";
> >
> > case 2:
> > return "that";
> >
> > default:
> > return "other";
> >
> > }
> > }
> >
>
>
> --
> 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]
I would like to see an editor with a built in code beutifier and un-beutifier. I like
the
if (true)
{
} else
{
}
method, but pear standards are
if (true) {
} else {
}
it would be nice to see ultra edit convert it to the first format for me and save it
as the second for pear.
--
Chris Lee
[EMAIL PROTECTED]
"Philip Olson" <[EMAIL PROTECTED]> wrote in message
Pine.BSF.4.10.10104192119590.43248-100000@localhost">news:Pine.BSF.4.10.10104192119590.43248-100000@localhost...
coding style? here's what pear has to say :
http://www.php.net/manual/en/pear.standards.php
http://www.php.net/manual/en/pear.standards.control.php
[ example ]
switch (condition) {
case 1:
action1;
break;
case 2:
action2;
break;
default:
defaultaction;
break;
}
[ /example ]
variables can be very useful.
return is cool too.
:)
regards,
philip
--
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]
IMHO, I like the second. Too much real-code time to break old
habits. I don't like returning mid-method. I -really- don't like it. =)
As for the placement of braces...I like
/* return type */ function PhpFunction(params)
{
}
I'm usually not too worried about whitespace, either, so I'm all about
if (true)
{
do_something();
}
else
{
do_something_else();
}
Whitespace, IMHO, LOOKS less efficient but has the advantage of
being easier to follow/read/debug. Also more space to put in debugging
snippets
in lieu of having a real interactive debugger with a stack trace. And I've
got LOTS
of diskspace.... =)
function foo($varArray){foreach($varArray as $element){echo "this is
'tighter'\n";echo "but is it really worth it?\";} if (sizeof($varArray) ==
1){echo "1 element";}else{echo sizeof($varArray);} echo "Know what I mean,
Vern?";}
-Szii
----- Original Message -----
From: Chris Lee <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 19, 2001 3:51 PM
Subject: Re: [PHP] Which is better coding style...
> I would like to see an editor with a built in code beutifier and
un-beutifier. I like the
>
> if (true)
> {
>
> } else
> {
>
> }
>
> method, but pear standards are
>
> if (true) {
>
> } else {
>
> }
>
> it would be nice to see ultra edit convert it to the first format for me
and save it as the second for pear.
>
>
> --
>
> Chris Lee
> [EMAIL PROTECTED]
>
>
>
> "Philip Olson" <[EMAIL PROTECTED]> wrote in message
Pine.BSF.4.10.10104192119590.43248-100000@localhost">news:Pine.BSF.4.10.10104192119590.43248-100000@localhost...
>
> coding style? here's what pear has to say :
>
> http://www.php.net/manual/en/pear.standards.php
> http://www.php.net/manual/en/pear.standards.control.php
>
> [ example ]
>
> switch (condition) {
> case 1:
> action1;
> break;
>
> case 2:
> action2;
> break;
>
> default:
> defaultaction;
> break;
>
> }
>
> [ /example ]
>
>
> variables can be very useful.
> return is cool too.
>
> :)
>
> regards,
> philip
>
>
>
> --
> 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]
egads... it distracts me to no end to see an if-else block broken up that
way... to me seeing
if( some expression ) {
some action
} else {
some other action
}
is the most normal thing in the world.
Same goes for the { at the end of the expression, such as
for( ... ) {
}
while( ... ) {
}
function SomeFunc() {
}
That's how I've written all my C, C++, JavaScript, ColdFusion CFSCRIPT, and
now PHP.
Joseph E. Sheble
a.k.a. Wizaerd
Wizaerd's Realm
Canvas, 3D, Graphics,
ColdFusion, PHP, and mySQL
http://www.wizaerd.com
=================================
> -----Original Message-----
> From: ..s.c.o.t.t.. [gts] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 19, 2001 2:05 PM
> To: Php-General
> Subject: RE: [PHP] Which is better coding style...
>
>
> OOooo...
>
> it drives me nuts when i see beginning brackets
> on seperate lines ;)
>
> i like to start brackets on the same line as the
> statement and finish them on a line of their own.
>
> if (...) {
> }
> else {
> }
>
> (it drives me nuts to see "} else {" also)
>
>
> > -----Original Message-----
> > From: Sander Pilon [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, April 19, 2001 4:32 PM
> > To: 'Php-General'
> > Subject: RE: [PHP] Which is better coding style...
> >
> >
> > Definitely the second style :)
> >
> > (If we were talking about C(++) then the first would have even been
> > forbidden by my companies coding standard as well as several coding
> > standards of other companies I worked for.)
> >
> > The reason is this - a function has one entrypoint (duh) and one
> > exitpoint. Jumping out of a function somewhere in the middle leads to
> > unmaintainable code, and bugs when extending that function and that
> > return is overlooked. But, as with the indenting and bracket placing, it
> > is a matter of religion. They would have to torture me for three weeks
> > to get me to place the brackets like you did in your example :)
> >
> >
> > function blah()
> > {
> > $retval = "";
> >
> > switch( $bob )
> > {
> > case 1:
> > $retval = "this";
> > break;
> >
> > case 2:
> > $retval = "that";
> > break;
> >
> > default:
> > $retval = "other";
> > break;
> > }
> >
> > return $retval;
> > }
> >
> > > -----Original Message-----
> > > From: ..s.c.o.t.t.. [gts] [mailto:[EMAIL PROTECTED]]
> > > Sent: 19 April 2001 21:31
> > > To: Php-General
> > > Subject: RE: [PHP] Which is better coding style...
> > >
> > >
> > > i say the first style.
> > >
> > > unneeded variables and other thingies just
> > > obscure things and make it harder to maintain.
> > >
> > >
> > > > -----Original Message-----
> > > > From: Boget, Chris [mailto:[EMAIL PROTECTED]]
> > > > Subject: [PHP] Which is better coding style...
> > > >
> > > > Which is better?
> > > >
> > > > function blah() {
> > > > switch( $bob ) {
> > > > case 1:
> > > > return "this";
> > > >
> > > > case 2:
> > > > return "that";
> > > >
> > > > default:
> > > > return "other";
> > > >
> > > > }
> > > > }
> > > >
> > >
> > >
> > > --
> > > 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]
>
>
>
Does PHP sport an ENUM or SET statement?
Or, equivalent?
Thanks.
Jason
Hi Guys,
Is there a method of extracting rows from a MySQL table Uniquely (as in only
once) ?..... For example, when a user performs a search, using two words,
it may return the same row twice if the search is spread over two or more
SQL "selections". An example:
If hypothetical row 129 is a Public House, but the public house doubles up
as a restaurant, a search like this might return the same result twice.
Here is our hypothetical pub:
id = 129
name = The Blue Bell Inn
category = Public House
description = The Blue Bell Inn is a hypothetical pub, in the heart of rural
England. Why not visit, have a drink and perhaps even dine in our fine
Restaurant area.
The user might perform the search, searching by "category" OR by
"description". So if they typed "Public House / Restaurant" as the query,
the following would occur:
$sql = "SELECT * FROM table WHERE category LIKE 'Public House / Restaurant'
OR description LIKE 'Public House / Restaurant'";
Surely that would bring the same row back twice..... Is there any way of
selecting from the table just once, without having to restrict the search
facility to something like:
"SELECT * FROM table WHERE category LIKE '%$searchtext%'";
as opposed to having the "OR" in as well?
Thanks, as always,
James.
On Fri, 20 Apr 2001 05:41, James, Yz wrote:
> Hi Guys,
>
> Is there a method of extracting rows from a MySQL table Uniquely (as in
> only once) ?..... For example, when a user performs a search, using two
> words, it may return the same row twice if the search is spread over
> two or more SQL "selections". An example:
>
> If hypothetical row 129 is a Public House, but the public house doubles
> up as a restaurant, a search like this might return the same result
> twice. Here is our hypothetical pub:
>
> id = 129
> name = The Blue Bell Inn
> category = Public House
> description = The Blue Bell Inn is a hypothetical pub, in the heart of
> rural England. Why not visit, have a drink and perhaps even dine in
> our fine Restaurant area.
>
> The user might perform the search, searching by "category" OR by
> "description". So if they typed "Public House / Restaurant" as the
> query, the following would occur:
>
> $sql = "SELECT * FROM table WHERE category LIKE 'Public House /
> Restaurant' OR description LIKE 'Public House / Restaurant'";
This of course won't select the hypothetical cae in question. Perhaps you
might be betterr off using a dropdown list built from the table of
categories that you are using as a lookup table (you are, aren't you?)
> Surely that would bring the same row back twice..... Is there any way
> of selecting from the table just once, without having to restrict the
> search facility to something like:
>
> "SELECT * FROM table WHERE category LIKE '%$searchtext%'";
Again, that won't work in this case - you might want to separate the
words in the search string and do an OR search on all the words.
>
> as opposed to having the "OR" in as well?
>
> Thanks, as always,
>
> James.
Broadly, in this type of situation the row will only be returned once
notwithstanding that it might meet several citeria.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
In article <9bng4u$ftc$[EMAIL PROTECTED]>,
[EMAIL PROTECTED] ("James, Yz") wrote:
> $sql = "SELECT * FROM table WHERE category LIKE 'Public House / Restaurant'
> OR description LIKE 'Public House / Restaurant'";
>
> Surely that would bring the same row back twice....
Surely not. Have you tried it yet? Unless there are duplicate rows in the
table (which should *not* be the case), each row that is matched by that
query should only be returned once per execution of the query.
> Is there any way of
> selecting from the table just once, without having to restrict the search
> facility to something like:
>
> "SELECT * FROM table WHERE category LIKE '%$searchtext%'";
>
> as opposed to having the "OR" in as well?
I'm not sure what you're after. If executing the top example is getting
you unwanted rows, perhaps you could re-post with some sample data and
pointing out which rows are being shown in duplicate. (It might also be a
good idea to re-check your data first if there's any possibility that there
are duplicate rows existing in the db. 'Cuz that's the kind of thing
that's gonna mis-lead you about how SQL queries normally work.)
--
CC
Hi George,
Yes. Use nl2br(); which converts line breaks (\n) to html break tags
(<BR>). You're better doing it when you pull data out of your database
rather than doing it as it goes in (if you're using a database in the first
place).
Format is as follows
:
$string = nl2br($string);
James.
> I have a text area which the client types information into, but is it
> possible to format the text for example if the user hits enter ,then it
will
> place a line break there,
>
>
> 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]
>
Hey,
Well, I would write two scripts. One to pregen a reference database and
one to search using that database.
The pregen could use the readdir function that Matthew Luchak suggested.
You could use the fopen command to get the pages.
fopen("http://localhost/name-of-file") will return the rendered page instead
of the page with the mixed-in source. You could then use the striptags()
function. Now you have just the text and it has any dynamic content from
the php code. Parse that file, throw out any words that are less than like
3 characters.
There are tons of ways to store the words and pages, the simpilest being to
just to store the word and then a list of the pages that it appears on.
Maybe even tie in how many times it appears in each page.
Anyway, throw that pregen page into a daily or hourly cron and boom, done.
Then write a search page that just looks for each word, find the correct
pages, and makes links to them.
I don't know of any sites that explain how to do search engines but this way
will work :)
SL.
----- Original Message -----
From: "Kevin A Williams" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 19, 2001 11:11 AM
Subject: [PHP] Site Searchable function
Hi,
I was wondering whether anyone could direct me in the direction of creating
a search function like the one on php.net?
I have tried looking rather fruitlessly to implement a system, would one
possible implementation be to use reference files for the information and
then use string matching to analyse the information, or search the source
.php files (although security issues of revealing scripts).
Thanks in advance
Sup,
You have to make the output write to a file.
Like
lynx http://www.page.come > /home/me/bleh.htm
SL.
----- Original Message -----
From: "Bertjan Schrader" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 19, 2001 4:15 AM
Subject: [PHP] Starting PHP script with crontab
> I need tot start a PHP script at night with the crontab. I tried to do it
> with lynx (lynx http://www.domain.nl/test.php) as a commandline within the
> crontab. Lynx is starting but the PHP script is not working. Anyone an
idea
> how to do it?
>
> OS: Redhat Linux 5.2
> Apache
> PHP as a apache module
>
> 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]
>
compile php as a cgi then do this
php -q test.php
done. no problem, it will probably install php into /usr/local/bin make sure its in
the path
--
Chris Lee
[EMAIL PROTECTED]
""Bertjan Schrader"" <[EMAIL PROTECTED]> wrote in message
9bmddj$hdd$[EMAIL PROTECTED]">news:9bmddj$hdd$[EMAIL PROTECTED]...
I need tot start a PHP script at night with the crontab. I tried to do it
with lynx (lynx http://www.domain.nl/test.php) as a commandline within the
crontab. Lynx is starting but the PHP script is not working. Anyone an idea
how to do it?
OS: Redhat Linux 5.2
Apache
PHP as a apache module
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]
Hello,
I'm somewhat new to PHP. I'm having problems with a script and I don't know
why. It is from a book, yet it does not work for some reason. Both Apache
and MySQL are on and are working fine on my system. The code deals with
creating tables within a database (the database already exists. The error is
that it could connect to the database, but couldn't create the table within
the specified DB. Below are two PHP files that work together for this
specific project. Any help with this is much appreciated. Here are the
scripts:
Script #1
<?php
// Check that the user entered the info. If not then direct them back to the
form
if ((!$table_name) || (!$num_fields)) {
header ("Location:
http://localhost/examples/dynamic/authentication/auth_app/show_createtable.h
tml");
exit;
}
$form_block = "<form method=\"post\" action=\"do_createtable.php\">
<input type=\"hidden\" name=\"table_name\"
value=\"$table_name\">
<table cellspacing=\"5\" cellpadding=\"5\">
<tr>
<th>FIELD NAME</th><th>FIELD TYPE</th><th>FIELD
LENGTH</th></tr>
";
for ($i = 0; $i < $num_fields; $i++) {
$form_block .= "<tr>
<td align=\"center\"><input type=\"text\"
name=\"field_name[]\" size=\"30\"></td>
<td align=\"center\">
<select name=\"field_type[]\">
<option value=\"char\">char</option>
<option value=\"date\">date</option>
<option value=\"float\">float</option>
<option value=\"int\">int</option>
<option value=\"text\">text</option>
<option value=\"varchar\">varchar</option>
</select>
</td>
<td align=\"center\"><input type=\"text\"
name=\"field_length[]\" size=\"5\"></td>
";
}
$form_block .= "<tr>
<td align=\"center\" colspan=\"3\"><input type=\"submit\"
value=\"Create Table\"></td>
</tr>
</table>
</form>
";
?>
<html>
<head>
<title>Create a Database Table: Step 2</title>
</head>
<body>
<h1>Define fields for <?php echo "$table_name"; ?></h1>
<?php echo "$form_block"; ?>
</body>
</html>
Script #2
<?php
$db_name="testDB";
$connection = @mysql_connect("localhost", "afghan", "office939") or
die ("Couldn't connect.");
$db = @mysql_select_db($db_name, $connection)
or die("Couldn't select database.");
$sql = "CREATE TABLE $table_name (";
for ($i = 0; $i < count($field_name); $i++) {
$sql .= "$field_name[$i] $field_type[$i]";
if ($field_length[$i] != "") {
$sql .= "(field_length[$i]),";
} else {
$sql .= ",";
}
}
$sql = substr($sql, 0, -1);
$sql .= ")";
$result = @mysql_query($sql,$connection) or die("Couldn't execute query.");
if ($result) {
$msg = "<p>$table_name has been created!</p>";
}
?>
<html>
<head>
<title>Create a Database Table: Step 3</title>
</head>
<body>
<h1>Adding table to <?php echo "$db_name"; ?>...</h1>
<?php echo "$msg"; ?>
</body>
</html>
check and see if you have create_privilege on the database, and also make
sure your code is clean...echo the sql statement before you use it and type
it into mysql from the mysql command line and see if it works then...
-jack
-----Original Message-----
From: Navid Yar [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 19, 2001 5:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Authentication
Hello,
I'm somewhat new to PHP. I'm having problems with a script and I don't know
why. It is from a book, yet it does not work for some reason. Both Apache
and MySQL are on and are working fine on my system. The code deals with
creating tables within a database (the database already exists. The error is
that it could connect to the database, but couldn't create the table within
the specified DB. Below are two PHP files that work together for this
specific project. Any help with this is much appreciated. Here are the
scripts:
Script #1
<?php
// Check that the user entered the info. If not then direct them back to the
form
if ((!$table_name) || (!$num_fields)) {
header ("Location:
http://localhost/examples/dynamic/authentication/auth_app/show_createtable.h
tml");
exit;
}
$form_block = "<form method=\"post\" action=\"do_createtable.php\">
<input type=\"hidden\" name=\"table_name\"
value=\"$table_name\">
<table cellspacing=\"5\" cellpadding=\"5\">
<tr>
<th>FIELD NAME</th><th>FIELD TYPE</th><th>FIELD
LENGTH</th></tr>
";
for ($i = 0; $i < $num_fields; $i++) {
$form_block .= "<tr>
<td align=\"center\"><input type=\"text\"
name=\"field_name[]\" size=\"30\"></td>
<td align=\"center\">
<select name=\"field_type[]\">
<option value=\"char\">char</option>
<option value=\"date\">date</option>
<option value=\"float\">float</option>
<option value=\"int\">int</option>
<option value=\"text\">text</option>
<option value=\"varchar\">varchar</option>
</select>
</td>
<td align=\"center\"><input type=\"text\"
name=\"field_length[]\" size=\"5\"></td>
";
}
$form_block .= "<tr>
<td align=\"center\" colspan=\"3\"><input type=\"submit\"
value=\"Create Table\"></td>
</tr>
</table>
</form>
";
?>
<html>
<head>
<title>Create a Database Table: Step 2</title>
</head>
<body>
<h1>Define fields for <?php echo "$table_name"; ?></h1>
<?php echo "$form_block"; ?>
</body>
</html>
Script #2
<?php
$db_name="testDB";
$connection = @mysql_connect("localhost", "afghan", "office939") or
die ("Couldn't connect.");
$db = @mysql_select_db($db_name, $connection)
or die("Couldn't select database.");
$sql = "CREATE TABLE $table_name (";
for ($i = 0; $i < count($field_name); $i++) {
$sql .= "$field_name[$i] $field_type[$i]";
if ($field_length[$i] != "") {
$sql .= "(field_length[$i]),";
} else {
$sql .= ",";
}
}
$sql = substr($sql, 0, -1);
$sql .= ")";
$result = @mysql_query($sql,$connection) or die("Couldn't execute query.");
if ($result) {
$msg = "<p>$table_name has been created!</p>";
}
?>
<html>
<head>
<title>Create a Database Table: Step 3</title>
</head>
<body>
<h1>Adding table to <?php echo "$db_name"; ?>...</h1>
<?php echo "$msg"; ?>
</body>
</html>
--
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]
In the future, do not post your mysql password on the list
Just a little piece of advice ;)
Also, try checking the online errata for the book (You didn't mention which
book so I can't point you in the right direction).
- Kath
----- Original Message -----
From: "Navid Yar" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 19, 2001 4:59 PM
Subject: [PHP] Authentication
> Hello,
>
> I'm somewhat new to PHP. I'm having problems with a script and I don't
know
> why. It is from a book, yet it does not work for some reason. Both Apache
> and MySQL are on and are working fine on my system. The code deals with
> creating tables within a database (the database already exists. The error
is
> that it could connect to the database, but couldn't create the table
within
> the specified DB. Below are two PHP files that work together for this
> specific project. Any help with this is much appreciated. Here are the
> scripts:
>
> Script #1
>
>
> <?php
>
> // Check that the user entered the info. If not then direct them back to
the
> form
>
> if ((!$table_name) || (!$num_fields)) {
> header ("Location:
>
http://localhost/examples/dynamic/authentication/auth_app/show_createtable.h
> tml");
> exit;
> }
>
> $form_block = "<form method=\"post\" action=\"do_createtable.php\">
> <input type=\"hidden\" name=\"table_name\"
> value=\"$table_name\">
> <table cellspacing=\"5\" cellpadding=\"5\">
> <tr>
> <th>FIELD NAME</th><th>FIELD TYPE</th><th>FIELD
> LENGTH</th></tr>
> ";
>
> for ($i = 0; $i < $num_fields; $i++) {
>
> $form_block .= "<tr>
> <td align=\"center\"><input type=\"text\"
> name=\"field_name[]\" size=\"30\"></td>
>
> <td align=\"center\">
> <select name=\"field_type[]\">
> <option value=\"char\">char</option>
> <option value=\"date\">date</option>
> <option value=\"float\">float</option>
> <option value=\"int\">int</option>
> <option value=\"text\">text</option>
> <option value=\"varchar\">varchar</option>
> </select>
> </td>
>
> <td align=\"center\"><input type=\"text\"
> name=\"field_length[]\" size=\"5\"></td>
> ";
> }
>
> $form_block .= "<tr>
> <td align=\"center\" colspan=\"3\"><input type=\"submit\"
> value=\"Create Table\"></td>
> </tr>
> </table>
> </form>
> ";
> ?>
>
> <html>
> <head>
> <title>Create a Database Table: Step 2</title>
> </head>
> <body>
>
> <h1>Define fields for <?php echo "$table_name"; ?></h1>
> <?php echo "$form_block"; ?>
>
> </body>
> </html>
>
>
>
>
>
> Script #2
>
>
> <?php
>
> $db_name="testDB";
>
> $connection = @mysql_connect("localhost", "afghan", "office939") or
> die ("Couldn't connect.");
>
> $db = @mysql_select_db($db_name, $connection)
> or die("Couldn't select database.");
>
> $sql = "CREATE TABLE $table_name (";
>
> for ($i = 0; $i < count($field_name); $i++) {
> $sql .= "$field_name[$i] $field_type[$i]";
> if ($field_length[$i] != "") {
> $sql .= "(field_length[$i]),";
> } else {
> $sql .= ",";
> }
> }
>
> $sql = substr($sql, 0, -1);
>
> $sql .= ")";
>
> $result = @mysql_query($sql,$connection) or die("Couldn't execute
query.");
>
> if ($result) {
> $msg = "<p>$table_name has been created!</p>";
> }
>
> ?>
>
> <html>
> <head>
> <title>Create a Database Table: Step 3</title>
> </head>
> <body>
>
> <h1>Adding table to <?php echo "$db_name"; ?>...</h1>
>
> <?php echo "$msg"; ?>
>
> </body>
> </html>
>
>
> --
> 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]
>
Kath,
Thank you, I completely forgot to strip the UserID and Password to MySQL.
The book is called PHP, Fast & Easy Web Development by Julie C. Meloni. The
errata is located at the somewhat famous www.thickbook.com (more
specifically http://www.thickbook.com/books/index.phtml, the book is the
first book listed on that page). The errata was helpful in some situations
where mistakes were noticable, but it doesn't go any further and it didn't
help solve the current problem I'm having. Perhaps I could have made a
mistake in the coding, who knows. All I know is that I tried checking and
rechecking my code and it looks fine to me. It is also the exact script from
the book, yet with the errata's corrections applied as well. Any help from
you or any of our other collegues on this newsgroup would be helpful. Thank
you for your response and attempt to help.
Navid Yar
-----Original Message-----
From: Kath [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 19, 2001 4:06 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] Authentication
In the future, do not post your mysql password on the list
Just a little piece of advice ;)
Also, try checking the online errata for the book (You didn't mention which
book so I can't point you in the right direction).
- Kath
----- Original Message -----
From: "Navid Yar" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 19, 2001 4:59 PM
Subject: [PHP] Authentication
> Hello,
>
> I'm somewhat new to PHP. I'm having problems with a script and I don't
know
> why. It is from a book, yet it does not work for some reason. Both Apache
> and MySQL are on and are working fine on my system. The code deals with
> creating tables within a database (the database already exists. The error
is
> that it could connect to the database, but couldn't create the table
within
> the specified DB. Below are two PHP files that work together for this
> specific project. Any help with this is much appreciated. Here are the
> scripts:
>
> Script #1
>
>
> <?php
>
> // Check that the user entered the info. If not then direct them back to
the
> form
>
> if ((!$table_name) || (!$num_fields)) {
> header ("Location:
>
http://localhost/examples/dynamic/authentication/auth_app/show_createtable.h
> tml");
> exit;
> }
>
> $form_block = "<form method=\"post\" action=\"do_createtable.php\">
> <input type=\"hidden\" name=\"table_name\"
> value=\"$table_name\">
> <table cellspacing=\"5\" cellpadding=\"5\">
> <tr>
> <th>FIELD NAME</th><th>FIELD TYPE</th><th>FIELD
> LENGTH</th></tr>
> ";
>
> for ($i = 0; $i < $num_fields; $i++) {
>
> $form_block .= "<tr>
> <td align=\"center\"><input type=\"text\"
> name=\"field_name[]\" size=\"30\"></td>
>
> <td align=\"center\">
> <select name=\"field_type[]\">
> <option value=\"char\">char</option>
> <option value=\"date\">date</option>
> <option value=\"float\">float</option>
> <option value=\"int\">int</option>
> <option value=\"text\">text</option>
> <option value=\"varchar\">varchar</option>
> </select>
> </td>
>
> <td align=\"center\"><input type=\"text\"
> name=\"field_length[]\" size=\"5\"></td>
> ";
> }
>
> $form_block .= "<tr>
> <td align=\"center\" colspan=\"3\"><input type=\"submit\"
> value=\"Create Table\"></td>
> </tr>
> </table>
> </form>
> ";
> ?>
>
> <html>
> <head>
> <title>Create a Database Table: Step 2</title>
> </head>
> <body>
>
> <h1>Define fields for <?php echo "$table_name"; ?></h1>
> <?php echo "$form_block"; ?>
>
> </body>
> </html>
>
>
>
>
>
> Script #2
>
>
> <?php
>
> $db_name="testDB";
>
> $connection = @mysql_connect("localhost", "afghan", "office939") or
> die ("Couldn't connect.");
>
> $db = @mysql_select_db($db_name, $connection)
> or die("Couldn't select database.");
>
> $sql = "CREATE TABLE $table_name (";
>
> for ($i = 0; $i < count($field_name); $i++) {
> $sql .= "$field_name[$i] $field_type[$i]";
> if ($field_length[$i] != "") {
> $sql .= "(field_length[$i]),";
> } else {
> $sql .= ",";
> }
> }
>
> $sql = substr($sql, 0, -1);
>
> $sql .= ")";
>
> $result = @mysql_query($sql,$connection) or die("Couldn't execute
query.");
>
> if ($result) {
> $msg = "<p>$table_name has been created!</p>";
> }
>
> ?>
>
> <html>
> <head>
> <title>Create a Database Table: Step 3</title>
> </head>
> <body>
>
> <h1>Adding table to <?php echo "$db_name"; ?>...</h1>
>
> <?php echo "$msg"; ?>
>
> </body>
> </html>
>
>
> --
> 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]
I'm using the mail() function to send email out via the web, and I've run in a problem
with escaped characters showing the slash in the emails.
I get the text for the email ($email_text, lets say) and then I strip the slashes and
put the new version in another variable ($nice_email_text). When using the mail
function, $nice_email_text is the data that gets sent out, but the slashes in the
escaped characters still show up in the messages. (With OE)
Any ideas what would be causing this? The scripts I've made are sending out emails to
customers, and I don't want all the " and ' characters to show up with slashes next to
them.
Isaac,
Something like this worked for me...
<?php
if ($article) {
print stripslashes(nl2br($article));
}
else {
print 'Please <a href="1.php">go back</a> and type an article before
sending.';
}
?>
Where $article would be the e-mail sent out in raw form.
-----Original Message-----
From: Isaac Force [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 19, 2001 4:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mail() and stripslashes()
I'm using the mail() function to send email out via the web, and I've run in
a problem with escaped characters showing the slash in the emails.
I get the text for the email ($email_text, lets say) and then I strip the
slashes and put the new version in another variable ($nice_email_text). When
using the mail function, $nice_email_text is the data that gets sent out,
but the slashes in the escaped characters still show up in the messages.
(With OE)
Any ideas what would be causing this? The scripts I've made are sending out
emails to customers, and I don't want all the " and ' characters to show up
with slashes next to them.
I'm trying to modify and e-commerce site which originally sent an email with
the credit card info in an email. Now they would like to pass credit card
numbers to a payment-processing service. For this particular service,
Authorize.net, you would normally direct the form data to the
payment-processing service. The page is currently setup to resubmit to
itself and validate fields before anything else.
I would like to keep that functionality but I'm wondering how to pass the
values onto the payment-processing center after the validation. The flow
would be, hit the submit button and send the data to the page to validate
the fields and then send the info to Authorize.net. The form currently has
about 15 fields to validate and only needs to pass 3 of them to the
payment-processing center.
I'm still relatively new to this and I'm thinking the only way to pass
variables is through a submitted form or the url and I don't want to put the
credit card info in the url.
Any help would be greatly appreciated.
Tom
>>.>>.>>>.>>>>>.>>>>>>>>>.>>>>>>>>
Tom Beidler
Orbit Tech Services
805.682.8972 (phone)
805.682.5833 (fax)
[EMAIL PROTECTED]
http://www.orbittechservices.com/
>>.>>.>>>.>>>>>.>>>>>>>>>.>>>>>>>>
Using the POST method will prevent the credit card data from being included
in the url. I would still be careful about sending data like this via a
POST to a form handler on an entirely different site. It would be better if
there was some sort of secure socket to transfer the data through.
--
phill
"Tom Beidler" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm trying to modify and e-commerce site which originally sent an email
with
> the credit card info in an email. Now they would like to pass credit card
> numbers to a payment-processing service. For this particular service,
> Authorize.net, you would normally direct the form data to the
> payment-processing service. The page is currently setup to resubmit to
> itself and validate fields before anything else.
>
> I would like to keep that functionality but I'm wondering how to pass the
> values onto the payment-processing center after the validation. The flow
> would be, hit the submit button and send the data to the page to validate
> the fields and then send the info to Authorize.net. The form currently has
> about 15 fields to validate and only needs to pass 3 of them to the
> payment-processing center.
>
> I'm still relatively new to this and I'm thinking the only way to pass
> variables is through a submitted form or the url and I don't want to put
the
> credit card info in the url.
>
> Any help would be greatly appreciated.
>
> Tom
>
> >>.>>.>>>.>>>>>.>>>>>>>>>.>>>>>>>>
> Tom Beidler
> Orbit Tech Services
> 805.682.8972 (phone)
> 805.682.5833 (fax)
> [EMAIL PROTECTED]
> http://www.orbittechservices.com/
> >>.>>.>>>.>>>>>.>>>>>>>>>.>>>>>>>>
>
>
>
> --
> 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]
>
I have a php file with a lot of user defined funtions and wraper
functions in the this global file. Almost all my pages then use the
funtions in this one file (and variables), this is so I can keep my
website very modulure. However I know that having php go through the
file takes a bit of processor time and was wondering if it would be wise
to break up this global file or (into global 1 and 2) or something and
then only use the global 1 when those function are needed and visa
versa. Am I correct in assuming that if that global file gets too big
PHP is going to have to chew on it longer and therefore hold up the
page?
Thanks
--
-------------------------------
Clayton Bluhm
Computer Engineering Student
[EMAIL PROTECTED] (School)
[EMAIL PROTECTED] (home)
On the last question, technically yes.
The key is, how big is big?
If the global file is less than 1000-2000 lines, I wouldn't worry about it.
If it starts getting so large that it's 50-100k, then yes you should
probably break it up.
Under 40k and don't even worry about it unless you are under an utterly
immense server-strain.
--
Plutarck
Should be working on something...
...but forgot what it was.
"Nashirak Bosk" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a php file with a lot of user defined funtions and wraper
> functions in the this global file. Almost all my pages then use the
> funtions in this one file (and variables), this is so I can keep my
> website very modulure. However I know that having php go through the
> file takes a bit of processor time and was wondering if it would be wise
> to break up this global file or (into global 1 and 2) or something and
> then only use the global 1 when those function are needed and visa
> versa. Am I correct in assuming that if that global file gets too big
> PHP is going to have to chew on it longer and therefore hold up the
> page?
>
> Thanks
>
> --
> -------------------------------
>
> Clayton Bluhm
>
> Computer Engineering Student
>
> [EMAIL PROTECTED] (School)
> [EMAIL PROTECTED] (home)
>
>
>
Chris & Paul,
Try using the new pdflib-4.0.0 .... It works great.
Here is what you have to do:
Goto: http://www.pdflib.com/pdflib/download/index.html
and download the source for unix.
Unzip and untar.
cd to pdflib-4.0.0/bind/php/ext/pdf
copy * php-4.0.4pl1/ext/pdf --- You may want to remove the current contents
of this directory first...
cd pdflib-4.0.0
configure --enable-php
make - you will get an error indicating that a makefile was not found ...
just ignore it.
make install
Link the newly created libraries to the /usr/lib directory:
ln -s /usr/local/lib/libpdf* /usr/lib
Next just rebuild PHP as normal only add --with-pdflib.
Have fun...
Dean
-----Original Message-----
From: Chris Fry [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 17, 2001 7:01 PM
To: Paul Gardiner
Cc: Grimes, Dean; [EMAIL PROTECTED]
Subject: Re: [PHP] PHP4.0.4pl1+PdfLib3.03+SCO
Guys,
I've admitted defeat and set up a Redhat 6.0 box which runs the web site and
talks to the SCO server as a database server. I'm doing this for a large
client
who wants a "Business Card Generator" on his site and PDF seems to be the
best
way to go as the printer wants a PDF file with the info to print on his
shells
(pre-printed sheets).
Tried to make this work about a year ago, PHP on Redhat talking to an
Informix
database on SCO, and failed miserably. Took about 15 minutes this time - I
read
the error messages!
The secret was that, even though DBPATH was set on the SCO machine it wasn't
being read by the Linux box. I modified the connect statement to the db to
include the DBPATH - hey presto!
$dbh = ifx_connect("/dbpath/dbname@dbserver", "userid", "password");
Performance is pretty good as well.
For this client this is actually the optimum solution, the SCO box was
running a
National e-commerce solution and acting as a dbserver for his internal sales
organisation as well. This takes the load off the SCO box and probably
provides
some extra security as well.
If you would like more info let me know.
Chris
Paul Gardiner wrote:
> Hello again Dean, Chris,
>
> Snap I'm afraid. I didn't spend too much time on it but it's on the list
of
> things to do. If I manage to get any further I'll let you know.
>
> If this is urgent though Chris, let me know your exact configure/build
> procedure and which versions you're using of the tiff, jpeg etc and also
how
> you built these. As there's not as many of us on SCO it maybe better if we
> put our heads together to get it sorted - you know what they say :o)
>
> Best regards,
> - Paul -
>
> ----- Original Message -----
> From: "Grimes, Dean" <[EMAIL PROTECTED]>
> To: "'Chris Fry'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, April 17, 2001 1:36 PM
> Subject: RE: [PHP] PHP4.0.4pl1+PdfLib3.03+SCO
>
> > I had the exact same problem.... Haven't had time to work it though.
> >
> > -----Original Message-----
> > From: Chris Fry [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, April 16, 2001 3:26 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] PHP4.0.4pl1+PdfLib3.03+SCO
> >
> >
> > Pdflib 3.03 compiles OK and builds a static library -
> > /usr/local/lib/libpdf.a.
> >
> > PHP fails to configure - cannot find PDF_show_boxed in the library -
> > pdflib extension requires pdflib 3.x.
> >
> > This command is in the library and the header file. Configure finds my
> > tiff & jpeg library (--with-tiff-dir=/usr/local
> > --with-jpeg-dir=/usr/local) but is either not finding the library
> > (--with-pdflib=/usr/local) or is not able to find PDF_show_boxed in the
> > library.
> >
> > Can anyone help??
> >
> > Chris
> >
> > --
> > Chris Fry
> > Quillsoft Pty Ltd
> > Specialists in Secure Internet Services and E-Commerce Solutions
> > 10 Gray Street
> > Kogarah
> > NSW 2217
> > Australia
> >
> > Phone: +61 2 9553 1691
> > Fax: +61 2 9553 1692
> > Mobile: 0419 414 323
> > eMail: [EMAIL PROTECTED]
> > http://www.quillsoft.com.au
> >
> > You can download our Public CA Certificate from:-
> > https://ca.secureanywhere.com/htdocs/cacert.crt
> >
> > **********************************************************************
> >
> > This information contains confidential information intended only for
> > the use of the authorised recipient. If you are not an authorised
> > recipient of this e-mail, please contact Quillsoft Pty Ltd by return
> > e-mail.
> > In this case, you should not read, print, re-transmit, store or act
> > in reliance on this e-mail or any attachments, and should destroy all
> > copies of them.
> > This e-mail and any attachments may also contain copyright material
> > belonging to Quillsoft Pty Ltd.
> > The views expressed in this e-mail or attachments are the views of
> > the author and not the views of Quillsoft Pty Ltd.
> > You should only deal with the material contained in this e-mail if
> > you are authorised to do so.
> >
> > This notice should not be removed.
> >
> >
> >
> > --
> > 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]
> >
> >
--
Chris Fry
Quillsoft Pty Ltd
Specialists in Secure Internet Services and E-Commerce Solutions
10 Gray Street
Kogarah
NSW 2217
Australia
Phone: +61 2 9553 1691
Fax: +61 2 9553 1692
Mobile: 0419 414 323
eMail: [EMAIL PROTECTED]
http://www.quillsoft.com.au
You can download our Public CA Certificate from:-
https://ca.secureanywhere.com/htdocs/cacert.crt
**********************************************************************
This information contains confidential information intended only for
the use of the authorised recipient. If you are not an authorised
recipient of this e-mail, please contact Quillsoft Pty Ltd by return
e-mail.
In this case, you should not read, print, re-transmit, store or act
in reliance on this e-mail or any attachments, and should destroy all
copies of them.
This e-mail and any attachments may also contain copyright material
belonging to Quillsoft Pty Ltd.
The views expressed in this e-mail or attachments are the views of
the author and not the views of Quillsoft Pty Ltd.
You should only deal with the material contained in this e-mail if
you are authorised to do so.
This notice should not be removed.
Hello!!!
I changed the version to bison 1.28...here is the log:
checking for working automake... found
checking for working autoheader... found
checking for working makeinfo... found
checking whether to enable maintainer-specific portions of Makefiles... no
checking host system type... i686-pc-linux-gnu
checking for mawk... (cached) gawk
checking for bison... (cached) bison -y
checking bison version... 1.28 (ok)
checking for gcc... (cached) gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking how to run the C preprocessor... (cached) gcc -E
checking for AIX... no
checking for gcc option to accept ANSI C... (cached) none needed
checking for ranlib... (cached) ranlib
checking whether gcc and cc understand -c and -o together... (cached) yes
checking whether ln -s works... (cached) yes
what do you think is going on???
Pablo Sabatino.
----- Original Message -----
From: "Kelly Cochran" <[EMAIL PROTECTED]>
To: "Pablo Sabatino" <[EMAIL PROTECTED]>
Sent: Thursday, April 19, 2001 5:37 PM
Subject: Re: [PHP] `AM_PROG_LIBTOOL' not found in library
>
> Did it warn you during configure about your bison version? I think
> 1.28 is required, and that error will pop up if you have an earlier
> version.
>
> Pablo Sabatino wrote:
> >
> > Thank you, Kelly!!!!
> > I tried compiling again and seems like was good!
> >
> > The ./configure that ok.
> > Now, when I execute $./gmake come to error...
> >
> > pablo@pablito:~/php4 > gmake
> > Making all in Zend
> > gmake[1]: Entering directory `/home/pablo/php4/Zend'
> > /bin/sh ../libtool --silent --mode=compile
> >
gcc -DHAVE_CONFIG_H -I. -I. -I../main -DLINUX=2 -DUSE_HSREGEX -DUSE_EXPAT
> > -DSUPPORT_UTF8 -DXML_BYTE_ORDER=12 -g -O2 -c zend_ini_parser.c
> > /usr/share/bison.simple:157: conflicting types for `ini_parse'
> > ./zend_ini_parser.y:51: previous declaration of `ini_parse'
> > /usr/share/bison.simple: In function `ini_parse':
> > /usr/share/bison.simple:219: number of arguments doesn't match prototype
> > /usr/share/bison.simple:157: prototype declaration
> > gmake[1]: *** [zend_ini_parser.lo] Error 1
> > gmake[1]: Leaving directory `/home/pablo/php4/Zend'
> > gmake: *** [all-recursive] Error 1
> >
> > Please, help me!!!!!!!
> > Pablo Sabatino.
> >
> > ----- Original Message -----
> > From: "Kelly Cochran" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, April 18, 2001 8:30 PM
> > Subject: Re: [PHP] `AM_PROG_LIBTOOL' not found in library
> >
> > >
> > > Do a 'which libtool' and I'd hazard a guess that it'll find the one in
> > > /usr/local/bin first. As it's using that libtool (dir:
/usr/local/bin)
> > > and your normal automake (dir: /usr/bin), the dirs don't match and
> > > aclocal fails, as the warning mentions. Either switch your path
around
> > > to move /usr/local/bin after /usr/bin (and end up using the libtool
your
> > > system came with), or reconfigure and reinstall libtool 1.3.5 starting
> > > with "./configure --prefix=/usr" which will cause it to install into
> > > /usr/bin, /usr/share, etc. (otherwise it defaults to /usr/local which
> > > is likely the problem you have right now).
> > >
> > > Pablo Sabatino wrote:
> > > >
> > > > Hello!!
> > > > I am using php4-cvs on Linux Suse 6.4.
> > > > I issued the command ./buildconf and got a message:
> > > >
> > > > pablo@pablito:~/php4 > ./buildconf
> > > > buildconf: checking installation...
> > > > buildconf: autoconf version 2.13 (ok)
> > > > buildconf: automake version 1.4 (ok)
> > > > buildconf: libtool version 1.3.5 (ok)
> > > >
> > > >
> > > > WARNING: automake and libtool are installed in different
> > > > directories. This may cause aclocal to fail.
> > > > continuing anyway
> > > > aclocal: configure.in: 810: macro `AM_PROG_LIBTOOL' not found in
> > library
> > > > make[1]: *** [aclocal.m4] Error 1
> > > > make: *** [all] Error 2
> > > > pablo@pablito:~/php4 >
> > > >
> > > > pablo@pablito:~/php4 > whereis libtool
> > > > libtool: /usr/bin/libtool /usr/local/bin/libtool
/usr/share/libtool
> > > > pablo@pablito:~/php4 > whereis automake
> > > > automake: /usr/bin/automake /usr/share/automake
> > > > pablo@pablito:~/php4 > whereis automake
> > > > automake: /usr/bin/automake /usr/share/automake
> > > > pablo@pablito:~/php4 >
> > > >
> > > > I installed libtool-1.3.5.
> > > > Help me, please!!
> > > > Pablo Sabatino..
> > >
> > > -- -
> > > Kelly Cochran <[EMAIL PROTECTED]>
> > > Technical Staff - funschool.com Corporation
> > >
> > > --
> > > 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]
> > >
>
> -- -
> Kelly Cochran <[EMAIL PROTECTED]>
> Technical Staff - funschool.com Corporation
> Phone: 408-453-7280x113 FAX: 408-453-7285
> Cell: 408-772-0657
> That's it. There's nothing special to do.
Except if one insert fails and the others succeed, you run into a bit of
sync trouble. This is what transactions are for. You might want to consider
a BDB table type, which supports transactions, then you have the option to
rollback the other inserts if one of them fails.
Julian
on 4/18/01 6:33 PM, Steve Werby at [EMAIL PROTECTED] wrote:
>
> "Fates" <[EMAIL PROTECTED]> wrote:
>> I know how to add data to one table but how do I add data to three
>> tables from one form?
>>
>> I want to do this with just one form and on one web page so it doesn't
>> post to another page.
>>
>> How do I set up the insert statement?
>>
>> $query = "INSERT INTO $table VALUES ('$menu_id', '$server',
>> '$menunumber', '$menuname')";
>>
>> $result = mysql_db_query($dbname, $query);
>
> Add two more sets of statements like those you have for the first query.
> That's it. There's nothing special to do.
>
> --
> Steve Werby
> President, Befriend Internet Services LLC
> http://www.befriend.com/
>
This does seem to work well. Thanks a lot.
unlink(session_save_path().'/sess_'.$PHPSESSID);
setcookie('PHPSESSID','',time()-3600,'/');
Ellis Heckman
[EMAIL PROTECTED]
http://www.sigmathree.com/
Check out http://php.net/manual/en/function.session-destroy.php
--
phill
""Ellis Heckman"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> This does seem to work well. Thanks a lot.
>
> unlink(session_save_path().'/sess_'.$PHPSESSID);
> setcookie('PHPSESSID','',time()-3600,'/');
>
> Ellis Heckman
> [EMAIL PROTECTED]
> http://www.sigmathree.com/
>
>
> --
> 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]
>
I'm Newbie - sorry if this is the wrong list!
I'm trying to print this treestructure I've made, but it doesn't seem to print more
than the first level. The
subtree array of the children is empty, perhaps because I do not
use the correct reference passing?
Thank you for helping me out.
This is the code:
<?php require('database.php'); // $databaseis defined here $database = new db(); class
TreeNode
{
var $data; //Database object reference
var $id; //Unique ID from the database
var $subtree; //Array of treenodes that are the children of $currentNode
var $level; //Level in the tree. The toplevel = 0 function
TreeNode($id, $data, $level) //Constructor
{
$this->id = $id;
$this->data = $data;
$this->level = $level;
$this->subtree = array();
} function add($currentNode)
{
//This function is used to add a TreeNode, $currentNode to the subtree
print "parent: ". $this->id ." New node: ". $currentNode->id ."<br>";
$this->subtree[] = $currentNode;
} function output()
{
for ($i=0;$i<count($this->subtree);$i++)
{
$tree =& $this->subtree[$i];
if (is_object($tree))
print "ID: ".$tree->id."<BR>";
print "Count: ".count($tree->subtree)."<BR>";
$tree->output();
} /* foreach ($this->subtree as $tree) //Skal være en while
løkke, da $tree->subtree er tomt.
{
if (is_object($tree))
print "ID: ".$tree->id."<BR>";
$tree->output();
}
*/
}
} //Initialize
$treetop = new TreeNode(0, 0, -1); // You have to have a start position
$nodehash = array(); // This is only used to find the
parents //Make the query
$sql = "SELECT * FROM page_table WHERE visible=1 ORDER BY id, title";
$query = new query($database, $sql); while ($obj = $query->getobj())
{
if($obj->parent_id > 0){ //If the node is not on the toplevel
$parent =& $nodehash["id_$obj->parent_id"]; //Finds the
parent in the $nodehash
}
else
{
$parent =& $treetop; //If the node is on
the toplevel then the parent is $treetop
}
$level = $parent->level + 1; //The tree level of $currentNode is of
course one more than the $parent (level
is not stored in db) //when we have found the level of $currentnode we are ready to
construct the $currentNode using the parameters
from the database and the $level
$currentNode = new TreeNode($obj->id, $obj, $level);
$nodehash["id_$obj->id"] = $currentNode; //Insert the $currentNode
into the $nodehash so we can find it again
if it has any children
$parent->add($currentNode); //Use the add function of the $parent to
put $currentNode into $parent's subtree
} //Something has to be printed out...
$treetop->output();
?>
I'm Newbie - sorry if this is the wrong list!
I'm trying to print this treestructure I've made, but it doesn't seem to
print more than the first level. The
subtree array of the children is empty, perhaps because I do not
use the correct reference passing?
Thank you for helping me out.
This is the code:
<?php
require('database.php'); // $databaseis defined here $database = new db();
class TreeNode
{
var $data; //Database object reference
var $id; //Unique ID from the database
var $subtree; //Array of treenodes that are the children of $currentNode
var $level; //Level in the tree. The toplevel = 0 function TreeNode($id,
$data, $level) //Constructor
{
$this->id = $id;
$this->data = $data;
$this->level = $level;
$this->subtree = array();
} function add($currentNode)
{
//This function is used to add a TreeNode, $currentNode to the subtree
print "parent: ". $this->id ." New node: ". $currentNode->id ."<br>";
$this->subtree[] = $currentNode;
} function output()
{
for ($i=0;$i<count($this->subtree);$i++)
{
$tree =& $this->subtree[$i];
if (is_object($tree))
print "ID: ".$tree->id."<BR>";
print "Count: ".count($tree->subtree)."<BR>";
$tree->output();
} /* foreach ($this->subtree as $tree) //Skal v�re en while l�kke, da
$tree->subtree er tomt.
{
if (is_object($tree))
print "ID: ".$tree->id."<BR>";
$tree->output();
}
*/
}
} //Initialize
$treetop = new TreeNode(0, 0, -1); // You have to have a start position
$nodehash = array(); // This is only used to find the parents //Make the
query
$sql = "SELECT * FROM page_table WHERE visible=1 ORDER BY id, title";
$query = new query($database, $sql); while ($obj = $query->getobj())
{
if($obj->parent_id > 0){ //If the node is not on the toplevel
$parent =& $nodehash["id_$obj->parent_id"]; //Finds the parent in the
$nodehash
}
else
{
$parent =& $treetop; //If the node is on the toplevel then the parent
is $treetop
}
$level = $parent->level + 1; //The tree level of $currentNode is of course
one more than the $parent (level
is not stored in db) //when we have found the level of $currentnode we are
ready to construct the
$currentNode using the parameters
from the database and the $level
$currentNode = new TreeNode($obj->id, $obj, $level);
$nodehash["id_$obj->id"] = $currentNode; //Insert the $currentNode into
the $nodehash so we can find it again
if it has any children
$parent->add($currentNode); //Use the add function of the $parent to put
$currentNode into $parent's subtree
}
//Something has to be printed out...
$treetop->output();
?>
this is my make_tree() function like your make_node() I think
function _make_tree($category_id)
{
global $database;
static $padding = -1;
foreach($database->select_array('', 'category', "WHERE category_parent =
$category_id ORDER BY category_name") as $pos => $result)
{
$id = $result['category_id'];
$category_id[$id] = $result['category_id'];
$category_parent[$id] = $result['category_parent'];
$category_name[$id] = $result['category_name'];
}
$padding++;
if (isset($category_id))
foreach ($category_id as $pos => $val)
{
$this->category_id[$pos] = $category_id[$pos];
$this->category_parent[$pos] = $category_parent[$pos];
$this->category_name[$pos] = $category_name[$pos];
$this->level[$pos] = str_repeat(' ', $padding * 2);
$this->_make_tree($category_id[$pos]);
}
$padding--;
}
all you need is three fields, the categories id, the categories parent, and the
categories name. recusion is tricky stuff :)
--
Chris Lee
[EMAIL PROTECTED]
""Johan Evers Petersen"" <[EMAIL PROTECTED]> wrote in message
9bnn77$524$[EMAIL PROTECTED]">news:9bnn77$524$[EMAIL PROTECTED]...
I'm Newbie - sorry if this is the wrong list!
I'm trying to print this treestructure I've made, but it doesn't seem to
print more than the first level. The
subtree array of the children is empty, perhaps because I do not
use the correct reference passing?
Thank you for helping me out.
This is the code:
<?php
require('database.php'); // $databaseis defined here $database = new db();
class TreeNode
{
var $data; //Database object reference
var $id; //Unique ID from the database
var $subtree; //Array of treenodes that are the children of $currentNode
var $level; //Level in the tree. The toplevel = 0 function TreeNode($id,
$data, $level) //Constructor
{
$this->id = $id;
$this->data = $data;
$this->level = $level;
$this->subtree = array();
} function add($currentNode)
{
//This function is used to add a TreeNode, $currentNode to the subtree
print "parent: ". $this->id ." New node: ". $currentNode->id ."<br>";
$this->subtree[] = $currentNode;
} function output()
{
for ($i=0;$i<count($this->subtree);$i++)
{
$tree =& $this->subtree[$i];
if (is_object($tree))
print "ID: ".$tree->id."<BR>";
print "Count: ".count($tree->subtree)."<BR>";
$tree->output();
} /* foreach ($this->subtree as $tree) //Skal være en while løkke, da
$tree->subtree er tomt.
{
if (is_object($tree))
print "ID: ".$tree->id."<BR>";
$tree->output();
}
*/
}
} //Initialize
$treetop = new TreeNode(0, 0, -1); // You have to have a start position
$nodehash = array(); // This is only used to find the parents //Make the
query
$sql = "SELECT * FROM page_table WHERE visible=1 ORDER BY id, title";
$query = new query($database, $sql); while ($obj = $query->getobj())
{
if($obj->parent_id > 0){ //If the node is not on the toplevel
$parent =& $nodehash["id_$obj->parent_id"]; //Finds the parent in the
$nodehash
}
else
{
$parent =& $treetop; //If the node is on the toplevel then the parent
is $treetop
}
$level = $parent->level + 1; //The tree level of $currentNode is of course
one more than the $parent (level
is not stored in db) //when we have found the level of $currentnode we are
ready to construct the
$currentNode using the parameters
from the database and the $level
$currentNode = new TreeNode($obj->id, $obj, $level);
$nodehash["id_$obj->id"] = $currentNode; //Insert the $currentNode into
the $nodehash so we can find it again
if it has any children
$parent->add($currentNode); //Use the add function of the $parent to put
$currentNode into $parent's subtree
}
//Something has to be printed out...
$treetop->output();
?>
--
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 thx, but it seems that my tree is build allright, I just can't get it
out on print...
I have in my add() function a printout and from this I believe that the tree
is build allright. All the treenodes are added to the correct subtree
arrays.
function add($currentNode)
{
//This function is used to add a TreeNode, $currentNode to the subtree
print "parent: ". $this->id ." New node: ". $currentNode->id ."<br>";
$this->subtree[] = $currentNode;
}
""Chris Lee"" <[EMAIL PROTECTED]> wrote in message
9bo0a6$v92$[EMAIL PROTECTED]">news:9bo0a6$v92$[EMAIL PROTECTED]...
this is my make_tree() function like your make_node() I think
function _make_tree($category_id)
{
global $database;
static $padding = -1;
foreach($database->select_array('', 'category', "WHERE category_parent =
$category_id ORDER BY category_name") as $pos => $result)
{
$id = $result['category_id'];
$category_id[$id] = $result['category_id'];
$category_parent[$id] = $result['category_parent'];
$category_name[$id] = $result['category_name'];
}
$padding++;
if (isset($category_id))
foreach ($category_id as $pos => $val)
{
$this->category_id[$pos] = $category_id[$pos];
$this->category_parent[$pos] = $category_parent[$pos];
$this->category_name[$pos] = $category_name[$pos];
$this->level[$pos] = str_repeat(' ', $padding * 2);
$this->_make_tree($category_id[$pos]);
}
$padding--;
}
all you need is three fields, the categories id, the categories parent, and
the categories name. recusion is tricky stuff :)
--
Chris Lee
[EMAIL PROTECTED]
""Johan Evers Petersen"" <[EMAIL PROTECTED]> wrote in message
9bnn77$524$[EMAIL PROTECTED]">news:9bnn77$524$[EMAIL PROTECTED]...
I'm Newbie - sorry if this is the wrong list!
I'm trying to print this treestructure I've made, but it doesn't seem to
print more than the first level. The
subtree array of the children is empty, perhaps because I do not
use the correct reference passing?
Thank you for helping me out.
This is the code:
<?php
require('database.php'); // $databaseis defined here $database = new db();
class TreeNode
{
var $data; //Database object reference
var $id; //Unique ID from the database
var $subtree; //Array of treenodes that are the children of $currentNode
var $level; //Level in the tree. The toplevel = 0 function TreeNode($id,
$data, $level) //Constructor
{
$this->id = $id;
$this->data = $data;
$this->level = $level;
$this->subtree = array();
} function add($currentNode)
{
//This function is used to add a TreeNode, $currentNode to the subtree
print "parent: ". $this->id ." New node: ". $currentNode->id ."<br>";
$this->subtree[] = $currentNode;
} function output()
{
for ($i=0;$i<count($this->subtree);$i++)
{
$tree =& $this->subtree[$i];
if (is_object($tree))
print "ID: ".$tree->id."<BR>";
print "Count: ".count($tree->subtree)."<BR>";
$tree->output();
} /* foreach ($this->subtree as $tree) //Skal v�re en while l�kke, da
$tree->subtree er tomt.
{
if (is_object($tree))
print "ID: ".$tree->id."<BR>";
$tree->output();
}
*/
}
} //Initialize
$treetop = new TreeNode(0, 0, -1); // You have to have a start position
$nodehash = array(); // This is only used to find the parents //Make the
query
$sql = "SELECT * FROM page_table WHERE visible=1 ORDER BY id, title";
$query = new query($database, $sql); while ($obj = $query->getobj())
{
if($obj->parent_id > 0){ //If the node is not on the toplevel
$parent =& $nodehash["id_$obj->parent_id"]; //Finds the parent in the
$nodehash
}
else
{
$parent =& $treetop; //If the node is on the toplevel then the parent
is $treetop
}
$level = $parent->level + 1; //The tree level of $currentNode is of course
one more than the $parent (level
is not stored in db) //when we have found the level of $currentnode we are
ready to construct the
$currentNode using the parameters
from the database and the $level
$currentNode = new TreeNode($obj->id, $obj, $level);
$nodehash["id_$obj->id"] = $currentNode; //Insert the $currentNode into
the $nodehash so we can find it again
if it has any children
$parent->add($currentNode); //Use the add function of the $parent to put
$currentNode into $parent's subtree
}
//Something has to be printed out...
$treetop->output();
?>
--
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]
I need some help figuring something out that my host denies is his problem.
I have a suspicion that only someone who has run into this problem once before has the
answer.
I have this form which posts to a PHP file. Sometimes I pass a file along. This was
info for a database and a picture along with it. This worked fine for the longest
time. Now it does not.
when I post a file in the form I recieve an "Cannot Find Server". When there isnt a
file posted then the form works fine. I dont understand because I recieve no PHP
generated error messages, but rather a problem finding the site entirely.
Has anyone ever seen this?
Help would be much
Marc Davenport
I have seen this before. For me it was a problem with the post operation.I'd
give specifics, but frankly I can't remember...sorry :(
----- Original Message -----
From: "Marc Davenport" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 19, 2001 6:19 PM
Subject: [PHP] Advanced Help Needed
I need some help figuring something out that my host denies is his problem.
I have a suspicion that only someone who has run into this problem once
before has the answer.
I have this form which posts to a PHP file. Sometimes I pass a file along.
This was info for a database and a picture along with it. This worked fine
for the longest time. Now it does not.
when I post a file in the form I recieve an "Cannot Find Server". When
there isnt a file posted then the form works fine. I dont understand
because I recieve no PHP generated error messages, but rather a problem
finding the site entirely.
Has anyone ever seen this?
Help would be much
Marc Davenport
I would put the code:
<? phpinfo(); ?>
at the bottom of your form page and run the page, without posting a file,
and see what the phpinfo says about file uploading. Perhaps it is disabled.
Even so, I can't understand why you would get a server not found. Hrm, well
maybe this will shed some light.
Matt Friedman
Spry New Media
http://www.sprynewmedia.com
Lead Programmer/Partner
email: [EMAIL PROTECTED]
phone: 250 744 3655
fax: 250 370 0436
----- Original Message -----
From: "Chris Anderson" <[EMAIL PROTECTED]>
To: "Marc Davenport" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, April 19, 2001 6:36 AM
Subject: Re: [PHP] Advanced Help Needed
> I have seen this before. For me it was a problem with the post
operation.I'd
> give specifics, but frankly I can't remember...sorry :(
> ----- Original Message -----
> From: "Marc Davenport" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, April 19, 2001 6:19 PM
> Subject: [PHP] Advanced Help Needed
>
>
> I need some help figuring something out that my host denies is his
problem.
>
> I have a suspicion that only someone who has run into this problem once
> before has the answer.
>
> I have this form which posts to a PHP file. Sometimes I pass a file
along.
> This was info for a database and a picture along with it. This worked
fine
> for the longest time. Now it does not.
> when I post a file in the form I recieve an "Cannot Find Server". When
> there isnt a file posted then the form works fine. I dont understand
> because I recieve no PHP generated error messages, but rather a problem
> finding the site entirely.
>
> Has anyone ever seen this?
>
> Help would be much
> Marc Davenport
>
>
>
> --
> 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]
>
>
>
Did you remember to base64 it? Perhaps some embedded chars
in the binary file are messing with you.
'Luck
-Szii
----- Original Message -----
From: Chris Anderson <[EMAIL PROTECTED]>
To: Marc Davenport <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, April 19, 2001 6:36 AM
Subject: Re: [PHP] Advanced Help Needed
> I have seen this before. For me it was a problem with the post
operation.I'd
> give specifics, but frankly I can't remember...sorry :(
> ----- Original Message -----
> From: "Marc Davenport" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, April 19, 2001 6:19 PM
> Subject: [PHP] Advanced Help Needed
>
>
> I need some help figuring something out that my host denies is his
problem.
>
> I have a suspicion that only someone who has run into this problem once
> before has the answer.
>
> I have this form which posts to a PHP file. Sometimes I pass a file
along.
> This was info for a database and a picture along with it. This worked
fine
> for the longest time. Now it does not.
> when I post a file in the form I recieve an "Cannot Find Server". When
> there isnt a file posted then the form works fine. I dont understand
> because I recieve no PHP generated error messages, but rather a problem
> finding the site entirely.
>
> Has anyone ever seen this?
>
> Help would be much
> Marc Davenport
>
>
>
> --
> 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 there a way to compare a value to a preset range.
for example;
$preset_ range = [0...65535]
$a[0] = "12";
$a[1] = "198";
$a[2] = "B";
$ac = count($a);
for($x=0; $x < $ac; $x++)
{
if($a[$x] != $preset_range)
{
$valid = 0;
}
else
{
valid = 1;
}
print($valid . "\n");
}
output should look like:
1
1
0
how is this accomplished in PHP?
thanks.
jason
this works:
$r_start = 0;
$r_end = 65535;
$a = array('12', '198', 'b');
while ( list($k,$v) = each($a) ) {
if ( ($v > $r_start) && ($v < $r_end) ) {
print "[$v] OK<BR>\n";
}
else {
print "[$v] NOPE<BR>\n";
}
}
> -----Original Message-----
> From: Jason Caldwell [mailto:[EMAIL PROTECTED]]
> Subject: [PHP] PHP and Ranges
>
>
> is there a way to compare a value to a preset range.
>
> for example;
>
> $preset_ range = [0...65535]
>
> $a[0] = "12";
> $a[1] = "198";
> $a[2] = "B";
>
> $ac = count($a);
>
> for($x=0; $x < $ac; $x++)
> {
> if($a[$x] != $preset_range)
> {
> $valid = 0;
> }
> else
> {
> valid = 1;
> }
>
> print($valid . "\n");
> }
>
> output should look like:
> 1
> 1
> 0
>
> how is this accomplished in PHP?
>
> thanks.
> jason
I can do it, it aint pretty though
<?php
for($c = 0; $c < 65535; $c++)
$range[] = $c;
$a[0] = '12';
$a[1] = '198';
$a[2] = 'B';
foreach($a as $pos => $val)
if (in_array($val, $range))
echo "True <br>";
else
echo "False <br>";
?>
works, just aint pretty.
--
Chris Lee
[EMAIL PROTECTED]
""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message
9bnos3$flm$[EMAIL PROTECTED]">news:9bnos3$flm$[EMAIL PROTECTED]...
is there a way to compare a value to a preset range.
for example;
$preset_ range = [0...65535]
$a[0] = "12";
$a[1] = "198";
$a[2] = "B";
$ac = count($a);
for($x=0; $x < $ac; $x++)
{
if($a[$x] != $preset_range)
{
$valid = 0;
}
else
{
valid = 1;
}
print($valid . "\n");
}
output should look like:
1
1
0
how is this accomplished in PHP?
thanks.
jason
--
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]
One way is:
$min = 0;
$max = 65535;
if ($var >= $min && $var <= $max)
{
...
}
Though I haven't heard of a range comparison, it would be nice if one
existed...especially if it could be something like "0-4, 6-8, 9-21", and it
would return true of the value was within any of the specified ranges.
But I don't know of it's specific existance.
--
Plutarck
Should be working on something...
...but forgot what it was.
""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message
9bnos3$flm$[EMAIL PROTECTED]">news:9bnos3$flm$[EMAIL PROTECTED]...
> is there a way to compare a value to a preset range.
>
> for example;
>
> $preset_ range = [0...65535]
>
> $a[0] = "12";
> $a[1] = "198";
> $a[2] = "B";
>
> $ac = count($a);
>
> for($x=0; $x < $ac; $x++)
> {
> if($a[$x] != $preset_range)
> {
> $valid = 0;
> }
> else
> {
> valid = 1;
> }
>
> print($valid . "\n");
> }
>
> output should look like:
> 1
> 1
> 0
>
> how is this accomplished in PHP?
>
> thanks.
> jason
>
>
>
>
>
> --
> 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]
>
how can i convert the charset in an e-mail from ascii or any iso-standard,
to the unicode-standard, so the webmail can be used outside english-speaking
areas?
Hi there,
Months ago I had a bad time getting PDFlib 3.0.0 to compile with PHP.. After
I succeeded I was so glad I promised myself to never touch it again.. :-)
Well, I now have a barcode font which I need to embed into a PDF document..
I did this a long time ago, but have forgotten what the exact settings were
that I used to accomplish this...
With some searching I suddenly saw that PDFlib 4.0.0 was available.. !! When
I looked at the documentation I got a tinteling feeling in my stomach..
Finally the package comes with all the Tif/Png etc libraries which you first
had to download seperately and try to compile with PDFlib.. Further this
package has also been adapted to PHP (they even talk about it in the
manual!!!) and it seems that you can also load the pdf as some kind of
library when starting the script via the 'dl' function.. ( which I don't yet
have any experience with..)
My question: Who has got some experience with this..? I grabbed a tarball of
php-4.0.4pl1 and pdflib4.0.0..
Compiled both and tried to load the library via de dl option.. PHP can't
seem to find this..
I am now busy to try and do it the old way and compile PHP with the PDFlib
option enabled..
(did copy the /ext/pdf directory from pdflib to my php!)
But if possible I would rather use the option in which the library is loaded
into PHP as an library.. Speed isues aren't important, I want an easy and
flexible way the change PDFlib versions without needing to recompile
anything..
I also read that this was possible with the GD library..
I will be glad if I can hear anyone with some experiences with this new
PDFlib.. I look forward getting this to work!
Thanks in advance..
With kind regards
David Bouw
Hi,
Using the above combination I issue the statement
SELECT COUNT(*) FROM mytable
I have tried using either odbc_prepare or odbc_do with each of the cursor types
SQL_CUR_USE_ODBC
SQL_CUR_IF_NEEDED
SQL_CUR_USE_DRIVER
SQL_CUR_DEFAULT
Instead of geting a resultset set with 1 row containing the count I am getting a
resultset as follows:
executing 'SELECT COUNT(*) FROM mytable'
NUM_ROWS:9
COUNT
1
1
1
1
1
1
1
1
1
I have issued the same SQL statemnt with the Progress tools and with the openlink
odbctest program and they both return 1 row with
the result
COUNT
9
Any help appreciated.
Regards
Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989
This is just a post to get in the archives. So if someone searches the
archives for this they'll hopefully hit this one and their problems will be
solved. I've battled this for two days..and have finally solved the
problem. I figure that the should help someone who had problems similar to
mine.
when you configure php with gd keep in mind that you need to have libgd.a
in /usr/lib. libgd.so won't do it!
watch:
./configure --with-mysql=/usr/local/mysql
--with-apache=/usr/src/apache_1.3.19 --enable-ftp
--with-jpeg-dir=/usr/src/jpeg-6b --with-png-dir=/usr/src/libpng-1.0.9
--with-freetype-dir=/usr/src/freetype-2.0.1/ --with-gd=/usr/src/gd-2.0.1
--with-imap=/usr/src/imap-4.5 --enable-gd-native-ttf' --enable-calendar'
you have to remember to do a make libgd.a in /usr/src/gd-2.0.1 (or where
ever you untarrred gd)
.a libs are for being statically linked with progs. .so libs are stand
alone, dynamic libs.
then everything works ok
you learn something new every day :-)
If anybody has questions i urge to ask me for a copy of the bash script
that i used to compile php with apache. Mail me at [EMAIL PROTECTED]
~kurth
Kurth Bemis
Owner: Ozone Computer
Owner/Senior Administrator: USAExpress.net LLC
HomePage: http://kurth.hardcrypto.com
Man kann niemanden zu seinem Glück zwingen
Thanks for all the advice, Brian. If you're referring to a database as
MySQL or any other database technology then I guess I haven't been precise
enough. I'm really quite new into PHP and I'm just using text files for
now. I'm slowly working my way up to MySQL, but fooling around with my
learned skills first.
Thanks!
-Owen
o-canada.org
right my goal was to actually alter the file size for quicker downloads and
less bandwidth. the solution was a combination of morgan's and joe's posts.
thansk guys!
- Noah
"Morgan Curley" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> This is a neat bit of code to fill in image height and width info but it
> does not affect the actual file size like resizing the image would
>
> morgan
>
> At 02:43 PM 4/19/2001, FredrikAT wrote:
> >Hi!
> >
> >This is what I do:
> >
> > if (!empty($picture)) {
> > $size = GetImageSize ("pics/$picture");
> > if ($size[0] >= '175') {
> > $width = '175';
> > $height = $size[1] * ($width / $size[0]);
> > } else {
> > $width = $size[0];
> > $height = $size[1];
> > }
> > }
> >
> >echo "<img src=\"pics\$picture\" height=\"$height\" width=\"$width\">";
> >
> >Fredrik A. Takle
> >Bergen, Norway
> >
> >
> >""Joe Sheble (Wizaerd)"" <[EMAIL PROTECTED]> skrev i
melding
> >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > >
> > > I use ImageMagik all the time for thumbnail creations... this doesn't
> > > resize the image, it creates a new image, a thumbnail... but the
principle
> > > is the same....
> > >
> > > $cWidth = 175;
> > > $picture_src = "fullSize/somepic.jpg";
> > > $thumb_dest = "fthumbNail/somepic.jpg";
> > >
> > > $aImageInfo = getimagesize( $picture_src );
> > >
> > > if( $aImageInfo[0] < $cWidth ) {
> > > exec("convert -geometry $cWidth -colors 256 -colorspace
> > > yuv $picture_src $thumb_dest" );
> > > }
> > >
> > > At 08:59 AM 4/19/01 -0400, Noah Spitzer-Williams wrote:
> > > >Is there a way to install the GD library on windows nt systems? i
can't
> >get
> > > >this thing to not scale it if its smaller than a certain width....
> > > >
> > > >""Steve Werby"" <[EMAIL PROTECTED]> wrote in message
> > > >00ae01c0c848$8a802bb0$6501a8c0@workstation7">news:00ae01c0c848$8a802bb0$6501a8c0@workstation7...
> > > > > "Noah Spitzer-Williams" <[EMAIL PROTECTED]> wrote:
> > > > > > I have a bunch of pictures all in ranging filesizes and
dimensions.
> >I
> > > >want
> > > > > > to resize the ones that over 175 pixels wide to a 175 pixel wide
> >picture
> > > > > > however i want the height to scale down (ie. i dont want a
really
> >thin
> > > > > > picture, i just want it to be what it would be if it were
resized).
> >i
> > > >have
> > > > > > this but i cant figure out how to just scale down the width:
> > > > > >
> > > > > > c:\progra~1\imagem~1\mogrify.exe -geometry 175x30! picture.jpeg
> > > > > >
> > > > > > the '!' forces those sizes to be used but obvoiusly i dont want
the
> > > >height
> > > > > > to be 30. i want it to be whatever it should be so the picture
> >doesnt
> > > >look
> > > > > > flattened.
> > > > >
> > > > > I believe imagemagick has an option where you can specify a single
> > > >dimension
> > > > > (x or y) and it will set that dimension accordingly and
automatically
> > > >scale
> > > > > the other dimension. This should be covered in the manual pages
> >or --help
> > > > > output of the program.
> > > > >
> > > > >
> > > > > --
> > > > > --
> > > > > Steve Werby
> > > > > President, Befriend Internet Services LLC
> > > > > http://www.befriend.com/
> > > > >
> > > > >
> > > > > --
> > > > > 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]
> > >
> >
> >
> >
> >--
> >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]
>
I just created a class that gets info resizes and stamps an image with
text. It's pretty simple, but works. If anyone wants it email me privately.
--Joe
On Wed, Apr 18, 2001 at 06:00:38PM -0400, Morgan Curley wrote:
> according to the docs use
> -geometry 175x175> picture.jpeg
>
> man mogrify:
> -geometry <width>x<height>{+-}<x offset>{+-}<y offset>{%}{!}{<}{>}
> preferred width and height of the image. See X(1) for
> details about the geometry specification.
>
> By default, the width and height are maximum values. That
> is, the image is expanded or contracted to
> fit the width and height value while maintaining the aspect
> ratio of the image. Append an exclamation
> point to the geometry to force the image size to exactly the
> size you specify. For example, if you
> specify 640x480! the image width is set to 640 pixels and
> height to 480. If only one factor is speci
> fied, both the width and height assume the value.
>
> To specify a percentage width or height instead, append
> %. The image size is multiplied by the width
> and height percentages to obtain the final image
> dimensions. To increase the size of an image, use a
> value greater than 100 (e.g. 125%). To decrease an image's
> size, use a percentage less than 100.
>
> Use > to change the dimensions of the image only if its size
> exceeds the geometry specification. <
> resizes the image only if its dimensions is less than the
> geometry specification. For example, if you
> specify 640x480> and the image size is 512x512, the image
> size does not change. However, if the image
> is 1024x1024, it is resized to 640x480.
>
> it looks like mogrify bases its resizing on the first value that is diff
> than the one supplied i.e. if your image is 200x50 it will scale it to
> 175x? but if it is 50x200 it will scale it to ?x175
>
> if it is important you not resize based on height use identify to get the
> geometry first.
>
> morgan
>
>
> At 04:27 PM 4/18/2001, Noah Spitzer-Williams wrote:
> >I have a bunch of pictures all in ranging filesizes and dimensions. I want
> >to resize the ones that over 175 pixels wide to a 175 pixel wide picture
> >however i want the height to scale down (ie. i dont want a really thin
> >picture, i just want it to be what it would be if it were resized). i have
> >this but i cant figure out how to just scale down the width:
> >
> >c:\progra~1\imagem~1\mogrify.exe -geometry 175x30! picture.jpeg
> >
> >the '!' forces those sizes to be used but obvoiusly i dont want the height
> >to be 30. i want it to be whatever it should be so the picture doesnt look
> >flattened.
> >
> >Thanks! - Noah
> >
> >
> >
> >--
> >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
* Sr. PHP Developer
* http://www.Care2.com http://www.joestump.net http://gtk.php-coder.net
*/
Is there a command which will tell me that it is the last in an array?
When I use END it just gives me the value IN the array... I want to know
when I hit the last element in an array...
This is driving me crazy...
Thanks.
Jason
What are you trying to do?
-Rasmus
On Thu, 19 Apr 2001, Jason Caldwell wrote:
> Is there a command which will tell me that it is the last in an array?
>
> When I use END it just gives me the value IN the array... I want to know
> when I hit the last element in an array...
>
> This is driving me crazy...
>
> Thanks.
> Jason
>
>
>
>
> --
> 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]
>
Jason,
You can use array_pop() to return the last element of the array -
$last_item = array_pop ($array);
but if you just want your array processing to stop when it's reached the
last item in the array (and avoid the loop) then do something like:
while (list ($var1, $var2) = each ($array))
HTH!
Best regards,
Andrew
--------------------------------------------
Andrew Hill - OpenLink Software
Directory of Technology Evangelism
Internet Data Integration Technology
http://www.openlinksw.com
On Thursday, April 19, 2001, at 07:57 PM, Jason Caldwell wrote:
> Is there a command which will tell me that it is the last in an array?
>
> When I use END it just gives me the value IN the array... I want to know
> when I hit the last element in an array...
>
> This is driving me crazy...
>
> Thanks.
> Jason
>
>
>
>
> --
> 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]
>
>
you can get the amount of elements in an array using count()
and use that # as an index value for 1+ the last value
(the last value that's NOT IN the array)
$a = array('12', '198', 'b');
print count($a);
this'll give you "3", which, as you can see,
the last valid subscript of $a is $a[2];
> -----Original Message-----
> From: Andrew Hill [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 19, 2001 17:08
> To: Jason Caldwell
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Last Element in an Array?
>
>
> Jason,
>
> You can use array_pop() to return the last element of the array -
>
> $last_item = array_pop ($array);
>
> but if you just want your array processing to stop when it's reached the
> last item in the array (and avoid the loop) then do something like:
>
> while (list ($var1, $var2) = each ($array))
>
> HTH!
>
> Best regards,
> Andrew
> --------------------------------------------
> Andrew Hill - OpenLink Software
> Directory of Technology Evangelism
> Internet Data Integration Technology
> http://www.openlinksw.com
>
> On Thursday, April 19, 2001, at 07:57 PM, Jason Caldwell wrote:
>
> > Is there a command which will tell me that it is the last in an array?
> >
> > When I use END it just gives me the value IN the array... I want to know
> > when I hit the last element in an array...
> >
> > This is driving me crazy...
> >
> > Thanks.
> > Jason
> >
> >
> >
> >
> > --
> > 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]
>
Hi,
I've been playing around with ClibPDF and am pulling my hair out trying
to figure out some functions, specifically, cpdf_rect. and cpdf_lineto.
They seem straight forward enough, but I just can't get them to work.
Here's what I've tried so far:
cpdf_setrgbcolor_fill($pdf, 253, 15, 15);
cpdf_rect($pdf,10,300,400,400, 0);
cpdf_closepath($pdf);
cpdf_fill($pdf);
cpdf_stroke($pdf);
and
cpdf_moveto($pdf, 50, 50);
cpdf_lineto($pdf, 200, 350);
cpdf_closepath($pdf);
cpdf_fill($pdf);
cpdf_stroke($pdf);
Any thoughts? What am I doing wrong???
Thanks,
Grant
Again - if you have imagemagick installed email me and I'll email you my little
class that does this.
--Joe
On Thu, Apr 19, 2001 at 10:02:47AM +0200, De Bodemschat wrote:
> Hello,
>
> I'm creating a bunch of photogalleries and wondering about the following:
>
> - Is it possible to convert an image or a whole dir with images (jpg) to 60%
> of the original imagesize using php to automate this task?
>
> I know the gd library is installed, but don't know if it supports jpg... And
> what functions do I need to use?
> >>
> gd-variables in phpinfo():
> GD Support enabled
> GD Version 1.6.2 or higher
> FreeType Support enabled
> FreeType Linkage with TTF library
> PNG Support enabled
> <<
>
> Hope you people can help.
> THanks,
>
> Bart Verbeek
>
>
> --
> 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
* Sr. PHP Developer
* http://www.Care2.com http://www.joestump.net http://gtk.php-coder.net
*/
$foo = `ls help*`;
$files = explode("\n",$foo);
while(list(,$fname) = each($files))
echo $fname."\n";
--Joe
On Thu, Apr 19, 2001 at 08:25:19AM -0400, [EMAIL PROTECTED] wrote:
> Hi,
>
> Does anyone know how I can list all the files begining with help in one of my
> pages.
>
> So I have a dir which has various files, like so:
>
> help_me.php
> help_you.php
> help_us.php
>
> Is there some command I can use to select all the files and then print them
> out?
>
> TIA
> Ade
>
> --
> 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
* Sr. PHP Developer
* http://www.Care2.com http://www.joestump.net http://gtk.php-coder.net
*/
this is what i use to scale down an arbitrary .GIF or .JPG
image to 150x150...
$image_name is the name of the original file that you want
to create a thumbnail of...
function save_thumb($image_name,$image_type) {
global $Svar;
$new_w = 150;
$new_h = 150;
$image_path = "/path/of/imagedir/". $image_name;
$thumb_path = "/path/of/thumbdir/" . $image_name;
if ($image_type == "image/pjpeg") {
$src_img = imagecreatefromjpeg($image_path);
}
elseif($image_type == "image/gif") {
$src_img = imagecreatefromgif($image_path);
}
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($s
rc_img));
imagejpeg($dst_img, $thumb_path . "_t.jpg");
return 1;
}
> -----Original Message-----
> From: Joe Stump [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 19, 2001 17:18
> To: De Bodemschat
> Cc: Php-General-list
> Subject: Re: [PHP] image-resize/convert
>
>
> Again - if you have imagemagick installed email me and I'll email you my little
> class that does this.
>
> --Joe
>
> On Thu, Apr 19, 2001 at 10:02:47AM +0200, De Bodemschat wrote:
> > Hello,
> >
> > I'm creating a bunch of photogalleries and wondering about the following:
> >
> > - Is it possible to convert an image or a whole dir with images (jpg) to 60%
> > of the original imagesize using php to automate this task?
> >
> > I know the gd library is installed, but don't know if it supports jpg... And
> > what functions do I need to use?
> > >>
> > gd-variables in phpinfo():
> > GD Support enabled
> > GD Version 1.6.2 or higher
> > FreeType Support enabled
> > FreeType Linkage with TTF library
> > PNG Support enabled
> > <<
> >
> > Hope you people can help.
> > THanks,
> >
> > Bart Verbeek
> >
> >
> > --
> > 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
> * Sr. PHP Developer
> * http://www.Care2.com http://www.joestump.net http://gtk.php-coder.net
> */
>
>
> --
> 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]
>
I have a PHP script which runs a query, and emails the results to me. I am
trying to make Cron run this script.
I can get it to launch my PHP script and it emails me fine, but the problem
is lynx gets caught up in a loop and it doesnt kill off after running the
script.
Is there something I need to add to my cron entry, or do I need to force
some sort of death via the php script ?
Thanks
Chris
--
Chris Aitken - Webmaster/Database Designer - IDEAL Internet
email: [EMAIL PROTECTED] phone: +61 2 4628 8888 fax: +61 2 4628 8890
--------------------------------------------
Unix -- because a computer's a terrible thing to waste!
I have a PHP script which runs a query, and emails the results to me. I am
trying to make Cron run this script.
I can get it to launch my PHP script and it emails me fine, but the problem
is lynx gets caught up in a loop and it doesnt kill off after running the
script.
Is there something I need to add to my cron entry, or do I need to force
some sort of death via the php script ?
Thanks
Chris
--
Chris Aitken - Webmaster/Database Designer - IDEAL Internet
email: [EMAIL PROTECTED] phone: +61 2 4628 8888 fax: +61 2 4628 8890
--------------------------------------------
Unix -- because a computer's a terrible thing to waste!
Hi
Just run
lynx -dump url > /dev/null
in the cron
Tom
At 10:55 AM 20/04/01 +1000, Chris Aitken wrote:
>I have a PHP script which runs a query, and emails the results to me. I am
>trying to make Cron run this script.
>
>I can get it to launch my PHP script and it emails me fine, but the
>problem is lynx gets caught up in a loop and it doesnt kill off after
>running the script.
>
>Is there something I need to add to my cron entry, or do I need to force
>some sort of death via the php script ?
>
>
>Thanks
>
>
>Chris
>
>
>
>
>--
> Chris Aitken - Webmaster/Database Designer - IDEAL Internet
>email: [EMAIL PROTECTED] phone: +61 2 4628 8888 fax: +61 2 4628 8890
> --------------------------------------------
>
> Unix -- because a computer's a terrible thing to waste!
>
>
>--
>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 everyone! I have the following problem:
I don't want any of my site's pages to be saved on any browser's cache.
Yet, I want all HTML forms to keep their data when the user changes to
another page without submiting and then comes back using the back button.
I have seen changing the session.cache_limiter configuration option to
'private' instead of 'nocache' works to make all forms keep their data, but
then all pages are diplayed from the browser's cache even after refreshing
several times!. I want a point in between, but I don't know how to get
there.
By the way, do you know what do the values that session.cache_limiter can
take mean? (nocache, private and public)
Thanks a lot you are all very kind.
Cheers, Diego.
> Hi everyone! I have the following problem:
> I don't want any of my site's pages to be saved on any browser's cache.
> Yet, I want all HTML forms to keep their data when the user changes to
> another page without submiting and then comes back using the back button.
>
> I have seen changing the session.cache_limiter configuration option to
> 'private' instead of 'nocache' works to make all forms keep their data, but
> then all pages are diplayed from the browser's cache even after refreshing
> several times!. I want a point in between, but I don't know how to get
> there.
>
> By the way, do you know what do the values that session.cache_limiter can
> take mean? (nocache, private and public)
When you set it to 'nocache' you get a set of HTTP headers that look like
this:
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
That forces things to not be cached anywhere.
The 'private' setting sends these headers:
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: private, max-age=10800, pre-check=10800
The expires header is set to a time in the past to force non-HTTP 1.1
compliant caches not to cache the page. For HTTP-1.1 caches that
understand the cache-control header the page will be cached only in
private caches (ie. the end-user http-1.1 compliant browser) for the time
specified by the session.cache_expire setting.
The 'public' setting sends headers like this:
Expires: Thu, 19 Apr 2001 20:57:16 GMT
Cache-Control: public, max-age=10800
Basically this means that the page is allowed to be cached in both public
(like AOL's proxy-cache) and private caches for the time specified by
session.cache_expire
And no, I don't know of a way to do what you want. I don't think you can
have the back button working and at the same time not allow private
caching.
-Rasmus
I have a table with users and their birthdates.
I want to SELECT all the users who have more than 18 years. How I can do
that using bisect years ? (february 28 days and 29 days)
plz help ...
Marian Vasile
IT Manager
Schnecker van Wyk & Pearson
www.investments.ro
+40 (0) 1 2309000
On Fri, 20 Apr 2001 11:35, Marian Vasile wrote:
> I have a table with users and their birthdates.
> I want to SELECT all the users who have more than 18 years. How I can
> do that using bisect years ? (february 28 days and 29 days)
>
> plz help ...
>
> Marian Vasile
> IT Manager
> Schnecker van Wyk & Pearson
> www.investments.ro
> +40 (0) 1 2309000
Leap years shouldn't be a problem? I don't know what DB you are using or
what format you store your dates - but if you can do a query something
like
SELECT * FROM table WHERE birthdate > (NOW()-18years)
using whatever your DB supports for the last bit :-) I _think_ it might
work as is with recent MySQL.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
On Fri, 20 Apr 2001 17:02, you wrote:
> Yes but how I can "say" 18 years ???
>
> Marian Vasile
> IT Manager
> Schnecker van Wyk & Pearson
> www.investments.ro
> +40 (0) 1 2309000
>
> > -----Original Message-----
> > From: David Robley [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, April 20, 2001 5:31 AM
> > To: Marian Vasile; [EMAIL PROTECTED]
> > Subject: Re: [PHP] more an SQL issue but I can't find any help
> >
> > On Fri, 20 Apr 2001 11:35, Marian Vasile wrote:
> > > I have a table with users and their birthdates.
> > > I want to SELECT all the users who have more than 18 years. How I
> > > can do that using bisect years ? (february 28 days and 29 days)
> > >
> > > plz help ...
> > >
> > > Marian Vasile
> > > IT Manager
> > > Schnecker van Wyk & Pearson
> > > www.investments.ro
> > > +40 (0) 1 2309000
> >
> > Leap years shouldn't be a problem? I don't know what DB you are using
> > or what format you store your dates - but if you can do a query
> > something like
> >
> > SELECT * FROM table WHERE birthdate > (NOW()-18years)
> >
> > using whatever your DB supports for the last bit :-) I _think_ it
> > might work as is with recent MySQL.
Well, it depends on your DB - for Mysql look for the date_sub or subdate
functions; for anything else, you'll have to RTM :-0
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
Greetings all,
I'm currently in the middle of developing a rather large piece of software written in
PHP. I'll spare you the details, but essentially it is a glorified FTP client. The
goal here, of course, is to develop a client that will work on any platform. In
theory, this SHOULD work, because PHP runs server-side, therefore eliminating any
problems that would normally arise from differences between the various platforms.
However, it occurred to me that there isn't really a way (that I know of) to directly
address a specific filename on a Macintosh as there is in other operating systems.
For example, in Windows I could type C:\WINDOWS\SYSTEM\BLAH.EXE or in Unix I could
type /var/spool/mail/whatever ... but is there a way to do such a thing on a Mac? Can
you directly address a file several levels deep in the filesystem without using the
MacOS interface itself to do so? The project I'm doing relies on the ability to do
just that, and it would appear that I've hit a bit of a snag.
If anyone can offer any suggestions or advice, I'd really appreciate it. Thanks in
advance.
Sincerely,
Shawn Reed
Chief Technology Officer
RBC Incorporated - home of "Remote Backup Center"
[ [EMAIL PROTECTED] / www.remotebackupcenter.com ]
On a Mac it is just diskname:folder1:folder2:blah.txt The colon is the path
delimiter, and is the only illegal character in a mac path.
But I'm most curious as to why you would need this. Presumably you're
writing your client in a web browser? In that case you're never really
exposed to the peculiarities of the client filesystem. And if you're writing
a network client, this would be taken care of by the API.
Julian
on 4/19/01 7:52 PM, Shawn Reed at [EMAIL PROTECTED] wrote:
>
> Greetings all,
>
> I'm currently in the middle of developing a rather large piece of software
> written in PHP. I'll spare you the details, but essentially it is a glorified
> FTP client. The goal here, of course, is to develop a client that will work
> on any platform. In theory, this SHOULD work, because PHP runs server-side,
> therefore eliminating any problems that would normally arise from differences
> between the various platforms.
>
> However, it occurred to me that there isn't really a way (that I know of) to
> directly address a specific filename on a Macintosh as there is in other
> operating systems. For example, in Windows I could type
> C:\WINDOWS\SYSTEM\BLAH.EXE or in Unix I could type /var/spool/mail/whatever
> ... but is there a way to do such a thing on a Mac? Can you directly address
> a file several levels deep in the filesystem without using the MacOS interface
> itself to do so? The project I'm doing relies on the ability to do just that,
> and it would appear that I've hit a bit of a snag.
>
> If anyone can offer any suggestions or advice, I'd really appreciate it.
> Thanks in advance.
--
Julian Wood
Learning Technologies and Digital Media
University of Calgary
Hey!
I'm a bit new at PHP, my page's at http://www.marthe.com.
My problem is that the counter on the page, from TheCounter.com, is far too
ugly.
Since I'm updating the page, I'm wondering if anyone has any good ideas on
how I should make one and what I should do.
Greetings,
Marthe
make one yourself:
a table with the data you want to store,
on every hit you insert there info, including Unique Session ID.
then use simple SQL queries to read your stats.
also see
http://www.phpbeginner.com/columns/McDonald/counter
there's an idea for beginners on how else it could work..
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-----Original Message-----
From: Marthe Kristiansen [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 20, 2001 11:08 AM
To: Php-General
Subject: [PHP] Newbie question: Page Counter
Hey!
I'm a bit new at PHP, my page's at http://www.marthe.com.
My problem is that the counter on the page, from TheCounter.com, is far too
ugly.
Since I'm updating the page, I'm wondering if anyone has any good ideas on
how I should make one and what I should do.
Greetings,
Marthe
--
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]
make a file called counter.php and include this text:
//-------------------------------------counter.php--------------------------
---------------//
<?php
//Simple PHP counter, v0.1. Send comments to [EMAIL PROTECTED]
if (file_exists('count.inc'))
{
$fil = fopen('count.inc', r);
$dat = fread($fil, filesize('count.inc'));
echo $dat+1;
fclose($fil);
$fil = fopen('count.inc', w);
fwrite($fil, $dat+1);
}
else
{
$fil = fopen('count.inc', w);
fwrite($fil, 1);
echo '1';
fclose($fil);
}
php?>
//--------------------------------------------------------------------------
--//
then make a file called count.inc and chmod it to 777 so anyone can write to
it. insert a number into the file.
//------------------------------count.inc-----------------------------------
--//
some value
//--------------------------------------------------------------------------
--//
then all u have to do is include the line:
<?php include (counter.php) ?> into the page you want a counter
hope this helps :) i use this script myself
-Adam
this counter'll increment the counter, no matter where are you go the page
from. If you only want that the counter increment for the first time
visitor visit the website, put the code at mainpage file, and check also
the page referrer weather it's a local url or not.
-toto-
Adam writes:
> make a file called counter.php and include this text:
>
> //-------------------------------------counter.php--------------------------
> ---------------//
>
> <?php
> //Simple PHP counter, v0.1. Send comments to [EMAIL PROTECTED]
> if (file_exists('count.inc'))
> {
> $fil = fopen('count.inc', r);
> $dat = fread($fil, filesize('count.inc'));
> echo $dat+1;
> fclose($fil);
> $fil = fopen('count.inc', w);
> fwrite($fil, $dat+1);
> }
> else
> {
> $fil = fopen('count.inc', w);
> fwrite($fil, 1);
> echo '1';
> fclose($fil);
> }
> php?>
>
> //--------------------------------------------------------------------------
> --//
>
>
> then make a file called count.inc and chmod it to 777 so anyone can write to
> it. insert a number into the file.
>
>
> //------------------------------count.inc-----------------------------------
> --//
> some value
>then make a file called count.inc and chmod it to 777 so anyone can write
to
>it. insert a number into the file.
Hey!
I tried to make this counter.php-file, that went ok, I think
My problem is to make the count.inc-file, I could make it but I have no idea
how to put "chmod" to "777" in it.
The number I am supposed to insert in the file is that just how many that
has allready visited or what is it?
And, it's just to insert a number, because I'd like it to allready have the
number that's on the counter I have today...
/Marthe
chmod is a *nix command. you do it to the file:
chmod 777 counter.inc
on the command line
-jack
-----Original Message-----
From: Marthe Kristiansen [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 20, 2001 3:04 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Newbie question: Page Counter
>then make a file called count.inc and chmod it to 777 so anyone can write
to
>it. insert a number into the file.
Hey!
I tried to make this counter.php-file, that went ok, I think
My problem is to make the count.inc-file, I could make it but I have no idea
how to put "chmod" to "777" in it.
The number I am supposed to insert in the file is that just how many that
has allready visited or what is it?
And, it's just to insert a number, because I'd like it to allready have the
number that's on the counter I have today...
/Marthe
--
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]
Funny isn't it?
The fact is that it is only her to see the error. The site is being tested
on all the browsers, especially on one particular machine in here overloaded
with all kind of different browsers for testing.
Nothing, never seen that error, only her on her browser...
I use cookies to maintain sessions, so if SID (from cookies) is not defined
then it is a very new visitor and we create one. Then session_id($SID) and
there we go...
Nor even her to see the error each time she visits the site, it happens only
once a moth...
really, weird...
Cheers,
Maxim Maletsky
-----Original Message-----
From: Yasuo Ohgaki [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 20, 2001 12:20 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] SESSIONS, a weird, funny yet strange error happens to
wrong people...
I was curious about your post, so I take a look at the module source.
It seems you could be right if O_EXCL is not defined when PHP is compiled.
If
O_EXCL is defined, it creates if there is no session data file.
--
Yasuo Ohgaki
""Plutarck"" <[EMAIL PROTECTED]> wrote in message
9bmjl2$rc4$[EMAIL PROTECTED]">news:9bmjl2$rc4$[EMAIL PROTECTED]...
> > What to fix?
>
>
> Her ;)
>
>
> Seriously though, is it possible that she stopped browsing the site long
> enough for the session to expire and be cleaned up by the garbage handler,
> then she continued on the page with a PHPSESSID that no longer existed?
>
> In that case the error would occur only once, as a new sessid with the
same
> number would be created right then.
>
>
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
>
>
> "Maxim Maletsky" <[EMAIL PROTECTED]> wrote in message
> DC017B079D81D411998C009027B7112A015ED114@EXC-TYO-01">news:DC017B079D81D411998C009027B7112A015ED114@EXC-TYO-01...
> >
> > hello guys...
> >
> > On one of our websites, where we use sessions, a funny error have
> happened.
> >
> > <err>
> > Warning: open(/tmp/sess_b5ad1e0878dee63fa8a780df44af3ea7, O_RDWR)
failed:
> > File exists (17) in page.japaninc.inc on line 109
> > </err>
> >
> > The funny side of it is that no one has ever seen it except our manager
> > (what a luck) from his PC only. I guess, we developers, visit our
art-work
> > much more often than our manager...
> >
> > She's seen it twice already, first time was a month-two ago and now
again.
> I
> > ignored it the first time, I though - well, happens... But now I start
to
> > think it is a bit weird (and dangerous for carrier).
> >
> > Any of you have any idea why this "rare" error keeps happening on her
> > browser and NEVER on any of developer's? (nor even any other employee of
> our
> > 200> company ever complained)...
> >
> > What to fix?
> >
> > Sincerely,
> >
> > Maxim Maletsky
> > Webmaster, J-Door.com / J@pan Inc.
> > LINC Media, Inc.
> > TEL: 03-3499-2175 x 1271
> > FAX: 03-3499-3109
> >
> > [EMAIL PROTECTED]
> >
> > www.j-door.com
> > www.japaninc.net
> > www.lincmedia.co.jp
> >
> >
> >
> >
> >
> >
>
>
>
----------------------------------------------------------------------------
> ----
>
>
> > --
> > 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]
Hello.
My question is:
How do I detect if mysql_connect() failed when I'm surpressing the error message with
@ like
$linkid = @mysql_connect("host","user","pass");
And how do I, if it failes, get the error message?
The manuel says that it:
[quote]Returns a positive MySQL link identifier on success, or an error message on
failure.[unquote]
In my mind I should be able to detect if it returns an errormessage like this:
if(!$linkid)
$error = mysql_error();
or:
if(!is_int($linkid))
$error = mysql_error();
Noone of theese 2 types works :-(.
I'm using is_int() because the manuel says that mysql_connect() returns an int. (How
can it then return an error message? I thought that an error message would be some
kind if string :-).)
Here comes another problem, when an error occours I should be able to see the message
with mysql_error() (since the linkid not contains an error message.)
Marcus R.
On Fri, 20 Apr 2001 12:19, Marcus Rasmussen wrote:
> Hello.
>
> My question is:
> How do I detect if mysql_connect() failed when I'm surpressing the
> error message with @ like $linkid =
> @mysql_connect("host","user","pass");
> And how do I, if it failes, get the error message?
>
> The manuel says that it:
> [quote]Returns a positive MySQL link identifier on success, or an error
> message on failure.[unquote]
>
> In my mind I should be able to detect if it returns an errormessage
> like this: if(!$linkid)
> $error = mysql_error();
> or:
> if(!is_int($linkid))
> $error = mysql_error();
> Noone of theese 2 types works :-(.
> I'm using is_int() because the manuel says that mysql_connect() returns
> an int. (How can it then return an error message? I thought that an
> error message would be some kind if string :-).)
>
> Here comes another problem, when an error occours I should be able to
> see the message with mysql_error() (since the linkid not contains an
> error message.)
>
> Marcus R.
Try testing the value of mysql_errno() and echo mysql_error accordingly.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
I CAN detect if an erro occours. (just some error I did)
I still don't get any return from mysql_errno() or mysql_error()
I don't iether get a return from mysql_errno() or mysql_error() when I do not surpress
with @ (the function, mysql_connect(), then prints a message.)
Guess I could surpress and write the error message myself, but I just want the
original one, wich I should be able to get with mysql_error()
PS. It is only mysql_connect that do it.
Marcus R.
*********** REPLY SEPARATOR ***********
On 20-04-01 at 12:35 David Robley wrote:
>On Fri, 20 Apr 2001 12:19, Marcus Rasmussen wrote:
>> Hello.
>>
>> My question is:
>> How do I detect if mysql_connect() failed when I'm surpressing the
>> error message with @ like $linkid =
>> @mysql_connect("host","user","pass");
>> And how do I, if it failes, get the error message?
>>
>> The manuel says that it:
>> [quote]Returns a positive MySQL link identifier on success, or an error
>> message on failure.[unquote]
>>
>> In my mind I should be able to detect if it returns an errormessage
>> like this: if(!$linkid)
>> $error = mysql_error();
>> or:
>> if(!is_int($linkid))
>> $error = mysql_error();
>> Noone of theese 2 types works :-(.
>> I'm using is_int() because the manuel says that mysql_connect() returns
>> an int. (How can it then return an error message? I thought that an
>> error message would be some kind if string :-).)
>>
>> Here comes another problem, when an error occours I should be able to
>> see the message with mysql_error() (since the linkid not contains an
>> error message.)
>>
>> Marcus R.
>
>Try testing the value of mysql_errno() and echo mysql_error accordingly.
>
>--
>David Robley | WEBMASTER & Mail List Admin
>RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
>AusEinet | http://auseinet.flinders.edu.au/
> Flinders University, ADELAIDE, SOUTH AUSTRALIA
>
>--
>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 5:22 AM +0200 4/20/01, Marcus Rasmussen wrote:
>I CAN detect if an erro occours. (just some error I did)
>
>I still don't get any return from mysql_errno() or mysql_error()
>I don't iether get a return from mysql_errno() or mysql_error() when
>I do not surpress with @ (the function, mysql_connect(), then prints
>a message.)
>
>Guess I could surpress and write the error message myself, but I
>just want the original one, wich I should be able to get with
>mysql_error()
>
>PS. It is only mysql_connect that do it.
I think this used to be in the docs or notes, but I couldn't find it
when I did a quick search.
As I understand it, mysql_error() and mysql_errno() only return
errors on an active connection. So, if the error occurs on
mysql_connect/pconnect(), they will not return anything. So, you can
do something like:
$LinkId = @mysql_connect(...);
if (!$LinkId) {
call error_function('Unable to connect to database;);
exit;
}
or, more simply:
$LinkId = @mysql_connect(...) or die('Unable to connect to database');
There's no way that I know of to get more details on WHY the connect
failed other than not using the '@' and seeing what the mysql_connect
error message does. In PHP4, you might be able to catch that message
using the output buffering functions, then format that the way you
want. See
http://www.php.net/manual/en/ref.outcontrol.php
for more info on output buffering.
-steve
>Marcus R.
>
>*********** REPLY SEPARATOR ***********
>
>On 20-04-01 at 12:35 David Robley wrote:
>
>>On Fri, 20 Apr 2001 12:19, Marcus Rasmussen wrote:
>>> Hello.
>>>
>>> My question is:
>>> How do I detect if mysql_connect() failed when I'm surpressing the
>>> error message with @ like $linkid =
>>> @mysql_connect("host","user","pass");
>>> And how do I, if it failes, get the error message?
>>>
>>> The manuel says that it:
>>> [quote]Returns a positive MySQL link identifier on success, or an error
>>> message on failure.[unquote]
>>>
>>> In my mind I should be able to detect if it returns an errormessage
>>> like this: if(!$linkid)
>>> $error = mysql_error();
>>> or:
>>> if(!is_int($linkid))
>>> $error = mysql_error();
>>> Noone of theese 2 types works :-(.
>>> I'm using is_int() because the manuel says that mysql_connect() returns
>>> an int. (How can it then return an error message? I thought that an
>>> error message would be some kind if string :-).)
>>>
>>> Here comes another problem, when an error occours I should be able to
>>> see the message with mysql_error() (since the linkid not contains an
>>> error message.)
>>>
>>> Marcus R.
>>
>>Try testing the value of mysql_errno() and echo mysql_error accordingly.
>>
>>--
>>David Robley | WEBMASTER & Mail List Admin
>>RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
>>AusEinet | http://auseinet.flinders.edu.au/
> > Flinders University, ADELAIDE, SOUTH AUSTRALIA
>>
--
+---------- KDVS 90.3fm Annual Fundraiser : 16 - 22 April 2001 ----------+
| Steve Edberg University of California, Davis |
| [EMAIL PROTECTED] Computer Consultant |
| http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ |
+----------------------------- www.kdvs.org -----------------------------+
Hi,
Any tips on how to speed-up dynamic page loads by either lessening the HTML file
sent or compressing it? I found two ways but don't exactly know how to do it.
1. Enable output buffering with compression. This seems to be only available on
php4.04. Is there a way to do this with php4.01?
2. Remove extraneous whitespaces. I normally program with heavy use of
indention, especially in table outputs, to make code more readable. But the
html files sent out also have these indentations and whitespaces. Is there a
code that can clean these out?
Thanks,
Floyd
you might want to look at mod_gzip
http://www.remotecommunications.com/apache/mod_gzip/
Regards
Andrew Braund
> -----Original Message-----
> From: Floyd Piedad [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 20 April 2001 13:33
> Cc: [EMAIL PROTECTED]
> Subject: [PHP] Output HTML Compression
>
>
> Hi,
>
> Any tips on how to speed-up dynamic page loads by either
> lessening the HTML file
> sent or compressing it? I found two ways but don't exactly
> know how to do it.
> 1. Enable output buffering with compression. This seems to
> be only available on
> php4.04. Is there a way to do this with php4.01?
> 2. Remove extraneous whitespaces. I normally program with
> heavy use of
> indention, especially in table outputs, to make code more
> readable. But the
> html files sent out also have these indentations and
> whitespaces. Is there a
> code that can clean these out?
>
> Thanks,
>
> Floyd
>
>
> --
> 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 discovered a bug in my program for uploading files, which stores the
filename in the database in order to create a link for it on the web page in
the future. The bug is when the filename makes use of special characters
(e.g. Oplæg). When I create a link to the file, the link works with
Netscape. With IE however, it says that file is not found. I discovered that
if I use the "encoded" version of the file name ("Opl%e6g") it works on both
IE and Netscape. What function or code is used to convert to this format?
Thanks!
Floyd
Could you enlighten me on the advantages or disadvantages and dangers of
turning-on both magic_quotes_gpc and magic_quotes_runtime?
Thanks,
Floyd Piedad
Plutarck wrote:
> Check magic_quotes_runtime in your ini. If it's on, turn it off.
>
> Use the htmlspecialchars() family of functions. They will "hide" HTML in
> that the browser will not attempt to parse. so "<B>" will be displayed as
> "<B>", and not make all the text turn to bold.
>
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
>
> ""Dddogbruce (@home.com)"" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > there is NO way of hiding the html from the user.
> > > the browser can't output otherwise. You can only
> > > try to make it difficult to get the source.
> >
> > I want to hide the HTML from the browser. If someone adds some malicious
> > code, or even <u></u> I don't want it to underline.
> >
> > > Where does the " 's " problem come in? More detail plz.
> > > Is it a part of a text? Then try htmlspecialchars() or
> > > htmlentities().
> >
> > Say I right "Hiya, my name's Owen" on the submission part of the form.
> It'll
> > show up as "Hiya, my name\'s Owen" on the output (which is a .txt file.)
> >
> > HTH,
> > Owen
> >
> >
> > --
> > 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]
I'm looking to compare if my array values match any digits or alpha
characters with a dot between them... so, if I think I understand Regular
Expressions (from what I could gather from PHP.net and Core PHP Programming
by Leon Atkinson.)
I want to match any of the following:
1.1 or a.a
or 1111.1111 or aaaa.aaaa <-- any number of digits (0-9) or alpha (a-z)
on either side of the dot.
if(eregi("^([0-9][a-z]\.[0-9][a-z]", $myArray[x]))
Is this correct? I think I'm missing something.
Thanks.
Jason
It seems good to me except there is an unbalanced '('...
-elias
http://www.kameelah.org/eassoft
""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message
9boi65$ipb$[EMAIL PROTECTED]">news:9boi65$ipb$[EMAIL PROTECTED]...
> I'm looking to compare if my array values match any digits or alpha
> characters with a dot between them... so, if I think I understand Regular
> Expressions (from what I could gather from PHP.net and Core PHP
Programming
> by Leon Atkinson.)
>
> I want to match any of the following:
>
> 1.1 or a.a
>
> or 1111.1111 or aaaa.aaaa <-- any number of digits (0-9) or alpha (a-z)
> on either side of the dot.
>
> if(eregi("^([0-9][a-z]\.[0-9][a-z]", $myArray[x]))
>
> Is this correct? I think I'm missing something.
>
> Thanks.
> Jason
>
>
>
>
> --
> 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]
>
(eregi("([0-9][a-z][A-Z]\.[0-9][a-z][A-Z]", $myArray[x]))
and don't use character '^' in front of the pattern.
-toto-
Jason Caldwell writes:
> I'm looking to compare if my array values match any digits or alpha
> characters with a dot between them... so, if I think I understand Regular
> Expressions (from what I could gather from PHP.net and Core PHP Programming
> by Leon Atkinson.)
>
> I want to match any of the following:
>
> 1.1 or a.a
>
> or 1111.1111 or aaaa.aaaa <-- any number of digits (0-9) or alpha (a-z)
> on either side of the dot.
>
> if(eregi("^([0-9][a-z]\.[0-9][a-z]", $myArray[x]))
>
> Is this correct? I think I'm missing something.
Hi Jason,
@ 1:43:19 AM on 4/20/2001, Jason Caldwell wrote:
...
> I want to match any of the following:
> 1.1 or a.a
> or 1111.1111 or aaaa.aaaa <-- any number of digits (0-9) or alpha (a-z)
> on either side of the dot.
> if(eregi("^([0-9][a-z]\.[0-9][a-z]", $myArray[x]))
Your parentheses are slightly wrong.
if(
eregi(
"^
(
/* unmatched parens */
[0-9][a-z]
/* only matches one digit or character */
\.
/* matches period */
[0-9][a-z]
/* only matches one digit or character */
",
$myArray[x]
)
/* syntax error :) */
)
> Is this correct? I think I'm missing something.
You want something like this:
<?php
/* eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $myArray[x]) */
$string = 'aaa.aaa';
$string_2 = 'aaaaaa';
print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string) ? 'matched' : 'no match');
print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string_2) ? 'matched' : 'no match');
?>
> Thanks.
> Jason
-Brian
--
PGP is spoken here: 0xE4D0C7C8
Please, DO NOT carbon copy me on list replies.
Thanks Brian!
Very helpful. Is there a good website that covers Regular Expressions?
Jason
"Brian Clark" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Jason,
>
> @ 1:43:19 AM on 4/20/2001, Jason Caldwell wrote:
>
> ...
> > I want to match any of the following:
>
> > 1.1 or a.a
>
> > or 1111.1111 or aaaa.aaaa <-- any number of digits (0-9) or alpha
(a-z)
> > on either side of the dot.
>
> > if(eregi("^([0-9][a-z]\.[0-9][a-z]", $myArray[x]))
>
> Your parentheses are slightly wrong.
>
> if(
> eregi(
> "^
> (
> /* unmatched parens */
>
> [0-9][a-z]
> /* only matches one digit or character */
>
> \.
> /* matches period */
>
> [0-9][a-z]
> /* only matches one digit or character */
> ",
> $myArray[x]
> )
> /* syntax error :) */
> )
>
> > Is this correct? I think I'm missing something.
>
> You want something like this:
>
> <?php
>
> /* eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $myArray[x]) */
>
> $string = 'aaa.aaa';
> $string_2 = 'aaaaaa';
>
> print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string) ? 'matched' : 'no
match');
> print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string_2) ? 'matched' : 'no
match');
>
> ?>
>
> > Thanks.
> > Jason
>
> -Brian
> --
> PGP is spoken here: 0xE4D0C7C8
> Please, DO NOT carbon copy me on list replies.
>
>
>
> --
> 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 Jason,
@ 2:19:48 AM on 4/20/2001, Jason Caldwell wrote:
> Thanks Brian!
No problemo.
> Very helpful. Is there a good website that covers Regular Expressions?
There is a GNU Regular Expressions Document out there somewhere if you
want to know most of it inside an out (google.com will probably take
you to it). It's real dry, to say the least.
There's also PCRE (Perl Compatible Regular Expressions). That's of
course if you know Perl (ree: perlre).
You didn't ask about books, but I have to recommend _Mastering Regular
Expressions_ (ISBN: 1565922573); Without reading that, I'd be lost.
Hmm, let's see..
PHP Builder's article:
http://www.phpbuilder.com/columns/dario19990616.php3
The perlre perldoc:
http://www.perl.com/CPAN-local/doc/manual/html/pod/perlre.html
Regular expressions section of the grep manual:
http://www.gnu.org/manual/grep-2.4/html_node/grep_6.html#SEC7
That may be enough to get you off to a very good start. There has to
be some better tutorials out there, but I just can't find any tonight.
(To tell you the truth, I'd buy the book)
-Brian
--
PGP is spoken here: 0xE4D0C7C8
Please, DO NOT carbon copy me on list replies.
I'm a little lost as to the exact function of the following:
^ and $
I noticed in the example below... that when I added the $ to the end of the
expression, I wasn't able anymore to put a non-alphanumeric character in the
end, for example (without the $)
I was able to enter the following and get a 'match'
aaa.a! <-- matched
aaa.! <-- no match
after I put the $ on the end
aaa.a! <-- no match
aaa.aa32 <-- match...
So, am I to understand that the ^ and $ are used to tell the expression that
it *must* match what the expression expects? I guess why I'm so confused is
because -- I thought when you create an expression, that it must match the
parameters of that expression... then what are the ^ $ for?? It's like to
create an expression, but it truly won't work unless you have it turned on
with ^ $ characters.
Thanks.
Jason
"Brian Clark" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Jason,
>
> @ 1:43:19 AM on 4/20/2001, Jason Caldwell wrote:
>
> ...
> > I want to match any of the following:
>
> > 1.1 or a.a
>
> > or 1111.1111 or aaaa.aaaa <-- any number of digits (0-9) or alpha
(a-z)
> > on either side of the dot.
>
> > if(eregi("^([0-9][a-z]\.[0-9][a-z]", $myArray[x]))
>
> Your parentheses are slightly wrong.
>
> if(
> eregi(
> "^
> (
> /* unmatched parens */
>
> [0-9][a-z]
> /* only matches one digit or character */
>
> \.
> /* matches period */
>
> [0-9][a-z]
> /* only matches one digit or character */
> ",
> $myArray[x]
> )
> /* syntax error :) */
> )
>
> > Is this correct? I think I'm missing something.
>
> You want something like this:
>
> <?php
>
> /* eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $myArray[x]) */
>
> $string = 'aaa.aaa';
> $string_2 = 'aaaaaa';
>
> print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string) ? 'matched' : 'no
match');
> print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string_2) ? 'matched' : 'no
match');
>
> ?>
>
> > Thanks.
> > Jason
>
> -Brian
> --
> PGP is spoken here: 0xE4D0C7C8
> Please, DO NOT carbon copy me on list replies.
>
>
>
> --
> 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]
>
Actually ordered that very book (earlier) tonight on Amazon. Looking
forward to getting it.
Thanks.
"Brian Clark" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Jason,
>
> @ 2:19:48 AM on 4/20/2001, Jason Caldwell wrote:
>
> > Thanks Brian!
>
> No problemo.
>
> > Very helpful. Is there a good website that covers Regular Expressions?
>
> There is a GNU Regular Expressions Document out there somewhere if you
> want to know most of it inside an out (google.com will probably take
> you to it). It's real dry, to say the least.
>
> There's also PCRE (Perl Compatible Regular Expressions). That's of
> course if you know Perl (ree: perlre).
>
> You didn't ask about books, but I have to recommend _Mastering Regular
> Expressions_ (ISBN: 1565922573); Without reading that, I'd be lost.
>
> Hmm, let's see..
>
> PHP Builder's article:
> http://www.phpbuilder.com/columns/dario19990616.php3
>
> The perlre perldoc:
> http://www.perl.com/CPAN-local/doc/manual/html/pod/perlre.html
>
> Regular expressions section of the grep manual:
> http://www.gnu.org/manual/grep-2.4/html_node/grep_6.html#SEC7
>
> That may be enough to get you off to a very good start. There has to
> be some better tutorials out there, but I just can't find any tonight.
>
> (To tell you the truth, I'd buy the book)
>
> -Brian
> --
> PGP is spoken here: 0xE4D0C7C8
> Please, DO NOT carbon copy me on list replies.
>
>
>
> --
> 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]
>
if you put ^ at the start of your regexp, that means you want the start of
the string to match your expression...$ is used for the end of the string...
-jack
-----Original Message-----
From: Jason Caldwell [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 20, 2001 2:41 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Regular Expressions?
I'm a little lost as to the exact function of the following:
^ and $
I noticed in the example below... that when I added the $ to the end of the
expression, I wasn't able anymore to put a non-alphanumeric character in the
end, for example (without the $)
I was able to enter the following and get a 'match'
aaa.a! <-- matched
aaa.! <-- no match
after I put the $ on the end
aaa.a! <-- no match
aaa.aa32 <-- match...
So, am I to understand that the ^ and $ are used to tell the expression that
it *must* match what the expression expects? I guess why I'm so confused is
because -- I thought when you create an expression, that it must match the
parameters of that expression... then what are the ^ $ for?? It's like to
create an expression, but it truly won't work unless you have it turned on
with ^ $ characters.
Thanks.
Jason
"Brian Clark" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Jason,
>
> @ 1:43:19 AM on 4/20/2001, Jason Caldwell wrote:
>
> ...
> > I want to match any of the following:
>
> > 1.1 or a.a
>
> > or 1111.1111 or aaaa.aaaa <-- any number of digits (0-9) or alpha
(a-z)
> > on either side of the dot.
>
> > if(eregi("^([0-9][a-z]\.[0-9][a-z]", $myArray[x]))
>
> Your parentheses are slightly wrong.
>
> if(
> eregi(
> "^
> (
> /* unmatched parens */
>
> [0-9][a-z]
> /* only matches one digit or character */
>
> \.
> /* matches period */
>
> [0-9][a-z]
> /* only matches one digit or character */
> ",
> $myArray[x]
> )
> /* syntax error :) */
> )
>
> > Is this correct? I think I'm missing something.
>
> You want something like this:
>
> <?php
>
> /* eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $myArray[x]) */
>
> $string = 'aaa.aaa';
> $string_2 = 'aaaaaa';
>
> print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string) ? 'matched' : 'no
match');
> print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string_2) ? 'matched' : 'no
match');
>
> ?>
>
> > Thanks.
> > Jason
>
> -Brian
> --
> PGP is spoken here: 0xE4D0C7C8
> Please, DO NOT carbon copy me on list replies.
>
>
>
> --
> 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 Fri, 20 Apr 2001 15:49, Jason Caldwell wrote:
> Thanks Brian!
>
> Very helpful. Is there a good website that covers Regular Expressions?
>
> Jason
>
>From my collection - there are duplicates^W^W^W. Heck, might as well tidy
this up. There aren't duplicates. Thanks to those who have variously
posted this information.
http://hotwired.lycos.com/webmonkey/geektalk/97/33/index3a.html
http://javaregex.com/
http://msdn.microsoft.com/workshop/languages/clinic/scripting051099.asp
http://perl.about.com/compute/perl/cs/regex/index.htm
http://virtual.park.uga.edu/humcomp/perl/regex2a.html
http://www.builder.com/Programming/Kahn/050698/index.html
http://www.ciser.cornell.edu/info/regex.html
http://www.contactor.se/~dast/mail2sms/regex.shtml
http://www.crusoe.net/~jeffp/documentation/perldoc/perlretut.html
http://www.delorie.com/gnu/docs/regex/regex_toc.html
http://www.delorie.com/gnu/docs/rx/rx_toc.html
http://www.devshed.com/Server_Side/Administration/RegExp/ 'So What's A
$#!%% Regular Expression, Anyway?!'
http://www.faqts.com/knowledge-base/index.phtml/fid/7/lang/
http://www.fornax.net/regex/
http://www.fornax.net/regex2/
http://www.naplesfl.net/~tbates/gravity/reg-100.html
http://www.opengroup.org/onlinepubs/7908799/xbd/re.html
http://www.oreilly.com/catalog/regex/
http://www.phpbuilder.com/columns/dario19990616.php3 Learning to Use
Regular Expressions by Example
http://www.python.org/doc/howto/regex/regex.html
http://www.robotwisdom.com/net/regexps.html
http://www.technobreeze.com/phptutorial/tutorial.regexp.php3
one interesting page is javaregex.com which could look a lot like a , oh,
phpregex.com ?
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
Thats what the book said too... but what I'm confused about is the word
START and END -- at what point does the start end, and the end begin? If
you look at my example below
aaa.a! <-- matched
>
> aaa.! <-- no match
>
> after I put the $ on the end
>
> aaa.a! <-- no match
>
> aaa.aa32 <-- match...
It looks like the ^ and $ are actually needed it you want the expression to
work correctly *at all*.
Thanks.
Jason
""Jack Dempsey"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> if you put ^ at the start of your regexp, that means you want the start of
> the string to match your expression...$ is used for the end of the
string...
>
> -jack
>
> -----Original Message-----
> From: Jason Caldwell [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 20, 2001 2:41 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Regular Expressions?
>
>
> I'm a little lost as to the exact function of the following:
>
> ^ and $
>
> I noticed in the example below... that when I added the $ to the end of
the
> expression, I wasn't able anymore to put a non-alphanumeric character in
the
> end, for example (without the $)
>
> I was able to enter the following and get a 'match'
>
> aaa.a! <-- matched
>
> aaa.! <-- no match
>
> after I put the $ on the end
>
> aaa.a! <-- no match
>
> aaa.aa32 <-- match...
>
> So, am I to understand that the ^ and $ are used to tell the expression
that
> it *must* match what the expression expects? I guess why I'm so confused
is
> because -- I thought when you create an expression, that it must match the
> parameters of that expression... then what are the ^ $ for?? It's like to
> create an expression, but it truly won't work unless you have it turned on
> with ^ $ characters.
>
> Thanks.
> Jason
>
>
>
> "Brian Clark" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi Jason,
> >
> > @ 1:43:19 AM on 4/20/2001, Jason Caldwell wrote:
> >
> > ...
> > > I want to match any of the following:
> >
> > > 1.1 or a.a
> >
> > > or 1111.1111 or aaaa.aaaa <-- any number of digits (0-9) or alpha
> (a-z)
> > > on either side of the dot.
> >
> > > if(eregi("^([0-9][a-z]\.[0-9][a-z]", $myArray[x]))
> >
> > Your parentheses are slightly wrong.
> >
> > if(
> > eregi(
> > "^
> > (
> > /* unmatched parens */
> >
> > [0-9][a-z]
> > /* only matches one digit or character */
> >
> > \.
> > /* matches period */
> >
> > [0-9][a-z]
> > /* only matches one digit or character */
> > ",
> > $myArray[x]
> > )
> > /* syntax error :) */
> > )
> >
> > > Is this correct? I think I'm missing something.
> >
> > You want something like this:
> >
> > <?php
> >
> > /* eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $myArray[x]) */
> >
> > $string = 'aaa.aaa';
> > $string_2 = 'aaaaaa';
> >
> > print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string) ? 'matched' : 'no
> match');
> > print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string_2) ? 'matched' :
'no
> match');
> >
> > ?>
> >
> > > Thanks.
> > > Jason
> >
> > -Brian
> > --
> > PGP is spoken here: 0xE4D0C7C8
> > Please, DO NOT carbon copy me on list replies.
> >
> >
> >
> > --
> > 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]
>
Hi Jason,
@ 2:40:34 AM on 4/20/2001, Jason Caldwell wrote:
> I'm a little lost as to the exact function of the following:
> ^ and $
^ beginning of a string.
$ end of a string.
> I noticed in the example below... that when I added the $ to the end of the
> expression, I wasn't able anymore to put a non-alphanumeric character in the
> end, for example (without the $)
> I was able to enter the following and get a 'match'
> aaa.a! <-- matched
Matches the expression with one or more alnum's before the \. and one
or more after the \.
! is [:punct:]
> aaa.! <-- no match
No alnum after the \. If you want to match that, replace the + with a
*
> after I put the $ on the end
> aaa.a! <-- no match
Doesn't match the expression \.[[:alnum:]]+$
> aaa.aa32 <-- match...
> So, am I to understand that the ^ and $ are used to tell the expression that
> it *must* match what the expression expects?
Yep; more precisely, ^[something]$ matches the whole string.
-Brian
--
PGP is spoken here: 0xE4D0C7C8
Please, DO NOT carbon copy me on list replies.
Hi Jason,
@ 2:43:26 AM on 4/20/2001, Jason Caldwell wrote:
> Actually ordered that very book (earlier) tonight on Amazon. Looking
> forward to getting it.
It's likely to be one of the most valuable books you own.
-Brian
--
PGP is spoken here: 0xE4D0C7C8
Please, DO NOT carbon copy me on list replies.
Brian --
Sorry if I seem dense. Your answer (although probably right on target)
leaves me still confused :-)
The example you gave me:
$string = 'aaaa.aaaa';
print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string) ? 'matched' : 'no
match');
Now with your example (above) the following MATCHED (when, I think it
shouldn't have:)
(example 1)
aaaa.a!
aaaa.a#$%
aaaa.a23!%
The following did NOT match.
(example 2)
a!.aaaa
a%!.aaaa
aaaa.!a34
Now when I took your example and added the $ at the end, like so:
print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)$", $string) ? 'matched' : 'no
match');
Everything that MATCHED in example 1 no longer matched, and in-fact, just
everything I wanted to match -- matched -- ie. just letters and numbers.
So... even though I had the [:alnum:] tag in the end -- without the $ at the
end it seems pointless?
So, I guess my (dense) question is -- why? Why doesn't it just work with
the [:alnum:] tag? I'm assuming ALNUM stands for Alpha-Numeric *only*?
"Brian Clark" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Jason,
>
> @ 2:40:34 AM on 4/20/2001, Jason Caldwell wrote:
>
> > I'm a little lost as to the exact function of the following:
>
> > ^ and $
>
> ^ beginning of a string.
> $ end of a string.
>
> > I noticed in the example below... that when I added the $ to the end of
the
> > expression, I wasn't able anymore to put a non-alphanumeric character in
the
> > end, for example (without the $)
>
> > I was able to enter the following and get a 'match'
>
> > aaa.a! <-- matched
>
> Matches the expression with one or more alnum's before the \. and one
> or more after the \.
>
> ! is [:punct:]
>
> > aaa.! <-- no match
>
> No alnum after the \. If you want to match that, replace the + with a
> *
>
> > after I put the $ on the end
>
> > aaa.a! <-- no match
>
> Doesn't match the expression \.[[:alnum:]]+$
>
> > aaa.aa32 <-- match...
>
> > So, am I to understand that the ^ and $ are used to tell the expression
that
> > it *must* match what the expression expects?
>
> Yep; more precisely, ^[something]$ matches the whole string.
>
>
> -Brian
> --
> PGP is spoken here: 0xE4D0C7C8
> Please, DO NOT carbon copy me on list replies.
>
>
>
> --
> 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 Jason,
@ 3:08:06 AM on 4/20/2001, Jason Caldwell wrote:
> Sorry if I seem dense. Your answer (although probably right on target)
> leaves me still confused :-)
No problem at all.
> The example you gave me:
> $string = 'aaaa.aaaa';
> print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string) ? 'matched' : 'no
> match');
> Now with your example (above) the following MATCHED (when, I think it
> shouldn't have:)
> (example 1)
> aaaa.a!
Matches because there is *at least* one alnum after the \.
It doesn't care about the ! as long as it found the a.
> aaaa.a#$%
Ditto here.
> aaaa.a23!%
Ditto here.
> The following did NOT match.
> (example 2)
> a!.aaaa
This didnt' match because of ^[[:alnum:]]+\.
There's a [:punct:] between the [:alnum:] and the \.
> a%!.aaaa
Ditto here.
> aaaa.!a34
No [:alnum:] after the \.
Your expression asks for *at least one* [:alnum:]
Changing + to * would make that match.
> Now when I took your example and added the $ at the end, like so:
> print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)$", $string) ? 'matched' : 'no
> match');
> Everything that MATCHED in example 1 no longer matched,
Right, because it had a [:punct:] before the end of the string and you
forced it to only pick up [:alnum:]'s
-Brian
--
PGP is spoken here: 0xE4D0C7C8
Please, DO NOT carbon copy me on list replies.
hi..
i have some problem regarding time() functions.it returns the time with some offset
w.r.t to our normal system time.for eg,if according to indian time its 2.10 it shows
4.30.how to solve this problem???
i have tried using many other functions date,mktime(),etc..
please help in this regard..
thanx in advance..
Reena
Get your free email with GroupWeb Worldmailer at
http://www.worldmailer.com. Send and receive e-mail
from any computer with a web browser.
On Fri, 20 Apr 2001 16:03, [EMAIL PROTECTED] wrote:
> hi..
> i have some problem regarding time() functions.it returns the time with
> some offset w.r.t to our normal system time.for eg,if according to
> indian time its 2.10 it shows 4.30.how to solve this problem??? i have
> tried using many other functions date,mktime(),etc..
> please help in this regard..
> thanx in advance..
> Reena
Does localtime help?
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
On Fri, 20 Apr 2001 16:45, you wrote:
> hello
> no even localtime didn't helped me..
> it's displaying the current time as 15:14 though the correct time is
> 12:45. please suggest if there is any other alternative..
> thanx..
> reena
>
> On Thu, 19 April 2001, David Robley wrote:
> > On Fri, 20 Apr 2001 16:03, [EMAIL PROTECTED] wrote:
> > > hi..
> > > i have some problem regarding time() functions.it returns the time
> > > with some offset w.r.t to our normal system time.for eg,if
> > > according to indian time its 2.10 it shows 4.30.how to solve this
> > > problem??? i have tried using many other functions
> > > date,mktime(),etc..
> > > please help in this regard..
> > > thanx in advance..
> > > Reena
> >
> > Does localtime help?
> >
Hm - if it's off by other than a multiple of 30 min I would suspect the
system time to be wrong, rather than a GMT offset.
I'm about to head off home, so further correspondence better go to the
list.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
Bob Friesenhahn wrote:
> On Thu, 12 Oct 2000, Mathur wrote:
>
> > Hi !
> > Now I have installed jpeg library seperately, and recompiled Imagemagick
> > --without-perl
> > The status after ./configure indicates that jpeg library is now available.
> > Now I am able to resize image from command line option. But the same thing
> > does not work thru PHP.
>
> It is likely that a user-space environment variable such as
> LD_LIBRARY_PATH, or even PATH is not set the same in the PHP
> environment as it is in in your normal working environment. You can
> either try to recreate this environment in the PHP server by exporting
> the environment variables before you run the utility, or you may be
> able to adjust the linkage of the ImageMagick utilities so that they
> include a hard-coded path to the libraries.
>
> Bob
> ===
> Bob Friesenhahn
> [EMAIL PROTECTED]
> http://www.simplesystems.org/users/bfriesen
Hi,
I'm getting LOTS of bounces whenever I send a message to this list. This is
the only lists from which I'm experiencing this kind of problems. It's very
annoying to receive multiple bounces because of one message.
Some are caused by misconfigured mailserver (solfix.net is a very good
example).
Others are caused by people who forget to unsubscribe whenever they get a
new email addess..
As I said before.. this is the only list I'm experiencing this kind of
problems.. so clean up if you're one of those people mentioned above.. Or
unsubscribe until you've got it all figured out..
Thanks,
B.
@ 2:52:37 AM on 4/20/2001, B. van Ouwerkerk wrote:
...
> Some are caused by misconfigured mailserver (solfix.net is a very good
> example).
Those morons (solfix.net) have been bugging absolute the s*$t out of
me with that stupid subscription request for months. Maybe someone
crafty should send their auto-responder into an infinite loop. I keep
hoping the list-admin will find out exactly who it is and end this
madness.
-Brian
--
PGP is spoken here: 0xE4D0C7C8
Please, DO NOT carbon copy me on list replies.
I have removed [EMAIL PROTECTED] from the lists. That address was
causing a number of the bounces. Gave him a full day to fix his MX
loop...
As for solfix.net. Not sure what can be done about them. There is no
solfix.net address subscribed and that domain is blocked from posting to
any of the lists.
-Rasmus
On Fri, 20 Apr 2001, Brian Clark wrote:
>
> @ 2:52:37 AM on 4/20/2001, B. van Ouwerkerk wrote:
>
> ...
> > Some are caused by misconfigured mailserver (solfix.net is a very good
> > example).
>
> Those morons (solfix.net) have been bugging absolute the s*$t out of
> me with that stupid subscription request for months. Maybe someone
> crafty should send their auto-responder into an infinite loop. I keep
> hoping the list-admin will find out exactly who it is and end this
> madness.
>
> -Brian
> --
> PGP is spoken here: 0xE4D0C7C8
> Please, DO NOT carbon copy me on list replies.
>
>
>
> --
> 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]
>
>Hello all, hope that everyone had a nice weekend.
>I'm new to this form. I am about to install mysql, apache, and php on my
>linux box
>(redhat 7)
WHy do you think people have invented archives for lists like these????
This question has been asked some many times I can't even remember. Same
question.. same answer..
www.devshed.com has a nice tutorial.. and please.. before sending another
question to this or any other list.. check the archive.... Or try a
searchengine, you'll be amazed to see what you can dig up..
Hope you'll enjoy PHP..
Bye,
B.
See a tutorial on PHPBeginner.com
http://www.phpbeginner.com/columns/enygma/install
this will pass you through the process.
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-----Original Message-----
From: B. van Ouwerkerk [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 20, 2001 4:01 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] SETUP PHP , MYSQL, APACHE
>Hello all, hope that everyone had a nice weekend.
>I'm new to this form. I am about to install mysql, apache, and php on my
>linux box
>(redhat 7)
WHy do you think people have invented archives for lists like these????
This question has been asked some many times I can't even remember. Same
question.. same answer..
www.devshed.com has a nice tutorial.. and please.. before sending another
question to this or any other list.. check the archive.... Or try a
searchengine, you'll be amazed to see what you can dig up..
Hope you'll enjoy PHP..
Bye,
B.
--
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]
hello,
I have a bunch of "Banner" strings (ie. $banner1, $banner2, $banner3,
$banner4). I have another set of "random" strings that randomly generate a
value 1-4 ($RandBanner1, $RandBanner2, $RandBanner3,$RandBanner4). Now I
want to display $banner1-4 randomly. I plan on doing this by:
print "$banner".$RandBanner1;
but that doesnt seem to work...Anyone got any other suggestions?
Any help is greatly appricaited.
Thanks in advance,
Ray
why not do this:
//generate your random number and save it in $randomNumber
switch($randomNumber){
case 1:
echo "$banner1";
break;
case 2:
echo "$banner2";
break;
case 3:
echo "$banner3";
break;
case 4:
echo "$banner4";
break;
}
-jack
-----Original Message-----
From: Ray Iftikhar [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 20, 2001 3:03 AM
To: Php-General List
Subject: [PHP] displaying string combinations
hello,
I have a bunch of "Banner" strings (ie. $banner1, $banner2, $banner3,
$banner4). I have another set of "random" strings that randomly generate a
value 1-4 ($RandBanner1, $RandBanner2, $RandBanner3,$RandBanner4). Now I
want to display $banner1-4 randomly. I plan on doing this by:
print "$banner".$RandBanner1;
but that doesnt seem to work...Anyone got any other suggestions?
Any help is greatly appricaited.
Thanks in advance,
Ray
--
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]
you can do:
echo ${"banner$RandBanner"}
this will create a variable for you.
However, I think you should be using an array. Things are getting much
faster and better.
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-----Original Message-----
From: Ray Iftikhar [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 20, 2001 4:03 PM
To: Php-General List
Subject: [PHP] displaying string combinations
hello,
I have a bunch of "Banner" strings (ie. $banner1, $banner2, $banner3,
$banner4). I have another set of "random" strings that randomly generate a
value 1-4 ($RandBanner1, $RandBanner2, $RandBanner3,$RandBanner4). Now I
want to display $banner1-4 randomly. I plan on doing this by:
print "$banner".$RandBanner1;
but that doesnt seem to work...Anyone got any other suggestions?
Any help is greatly appricaited.
Thanks in advance,
Ray
--
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]
Anyone know how to get the Zend Optimizer work on Solaris 8 x86? i can only
download the Sparc version of Zend Optimizer, but it don't work on x86.
Thanks in advance.
----
Chris
Hi,
has anyone ever seen the message "Network error occured while Netscape
was receiving data ..."
This happens when i save data in my informix database. The values are
saved, but i get the error message when the browser trys to load the new
page. The strange thing is, it happens only sometimes on various sites.
I think it has something to do with the traffic on the site (ca. 400
users).
After inserting a flush() into the page, which i want to load, i get
parts of the new page. I saved this page on disk and had a look at the
HTML, it´s complete, but my browser can´t show it and i get the network
error message.
If i make a "View Source" of the uncomplete page i get:
<TITLE>Missing Post reply data</TITLE>
<H1>Data Missing</H1>
This document resulted from a POST operation and has expired from the
cache. If you wish you can repost the form data to recreate the document
by pressing the <b>reload</b> button.
I´m working on NT4, php4.0.4pl1, ODBC-> Informix Database
Thanks for any help!
Claudia